MPDF showing an extra page at the end

2019-07-04 03:04发布

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.?

标签: php pdf mpdf
1条回答
Animai°情兽
2楼-- · 2019-07-04 04:08

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.

查看更多
登录 后发表回答