问题
I have used mpdf for generating pdf from html.
There is one problem that this generated pdf showing one page extra. If content is end at page 1 then it generates 2 pages and if content ends at page 2 then it generates three pages.
Here is my code-
<?php
include("mpdf/mpdf.php");
$mpdf=new mPDF('fsalbertpro','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);
$html='----'; // this variables contain all css and HTML to be shown in PDF
ob_clean(); // cleaning the buffer before Output()
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$mpdf->WriteHTML($html);
$mpdf->Output();
?>
Then how Can I remove the last blank page.?
回答1:
I had the same problem. At one point I had a
style="page-break-after:always"
which lead to the empty page. After removing it, the empty page disappeared.
来源:https://stackoverflow.com/questions/30079142/mpdf-showing-an-extra-page-at-the-end