简体   繁体   中英

html footer is not stretching in mpdf

Hi I am using mpdf to generate pdfs. My problem is when i was using the following configuration, The header was working fine and stretching based on content, But footer was becoming static and not stretching the when content was more than space for the footer, And if footer content is more, it was cropped.

class MyPDF extends mPDF {
    protected $pdfFileName;
    private $PDFExtension = '.pdf';
    protected  $downloadPDFMode = 'D';
    protected $pdfDownloadModes = array('D', 'F', 'S');
    private $pdfPath = 'test/';
    private $pdfMode = ''; //For loading fonts
    private $pageFormat = 'A4'; //Default A4 size
    private $marginLeft = 5;
    private $marginRight = 5;
    private $marginTop = 5;
    private $marginBottom = 5;
    private $marginHeader = 9;
    private $marginFooter = 35;
    private $javascript;
    private $n_js;

function __construct() {
    parent::mPDF($this->pdfMode, $this->pageFormat, '', '',$this->marginLeft,$this->marginRight, $this->marginTop, $this->marginBottom, $this->marginHeader, $this->marginFooter);
    parent::SetAutoFont(AUTOFONT_ALL);
    $this->setAutoTopMargin = true;
    $this->setAutoBottomMargin = 'stretch';

}

Please help me in this. Thanks in advance..

For several reasons, mainly the age of the post, I don't imagine this will help you in particular, but I feel that MPDF's documentation is frustratingly hard to decipher, and hopefully I may be able to help someone is a similar position.

I see that you've bumped up your $marginFooter value. This value seems to be for the space underneath the footer, and will simply slide your footer up into the body of your document.

The $marginBottom value, however, sets the space allowed under the body, allowing room for your footer. I suggest lowering your $marginFooter value, and bumping up your $marginBottom value until your footer clears your body.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM