MPDF showing an extra page at the end

纵饮孤独 提交于 2019-12-23 17:09:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!