Reputation: 401
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..
Upvotes: 2
Views: 844
Reputation: 61
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.
Upvotes: 1