I\'m trying to create a PDF file using mPDF class and I need it to auto-height my document and not create blank spaces at bottom.
Here\'s two images of two different gen
Solved.
I had one issue in my code that was creating that amount of space and it was on CSS structure.
body { font-size: 80% }
And changing to 100% solved the blank space, but I also look into the mPDF class and I found the _setPageSize()
function.
public function write($html, $url)
{
/*
* Writing and remove the content, allows the setAutoTopMargin to work
*
* http://www.mpdf1.com/forum/discussion/621/margin-top-problems/p1
*/
$this->mPDF->WriteHTML($html[0]);
$this->mPDF->page = 0;
$this->mPDF->state = 0;
unset($this->mPDF->pages[0]);
// The $p needs to be passed by reference
$p = 'P';
$this->mPDF->_setPageSize(array(56, $this->mPDF->y), $p);
foreach($html as $content)
{
$this->mPDF->addPage();
$this->mPDF->WriteHTML($content);
}
$this->mPDF->Output($url);
}