我已经使用mpdf从html生成pdf。
有一个问题是,这个生成的pdf会显示额外的一页。如果内容在第1页结束,则它生成2个页面,如果内容在第2页结束,则它生成3个页面。
这是我的代码-
<?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();
?>那我怎么才能去掉最后一个空白页呢?
发布于 2016-11-28 17:44:02
我也有同样的问题。在某一时刻,我有一个
style="page-break-after:always" 这将导致空页。删除后,空页面消失了。
发布于 2020-03-02 03:52:02
在跟踪我的代码以找到解决方案时,我注意到在使用某个类名之后出现了空页面!那么唯一的解决方案就是类的重命名!
我有:
<div class="A4 paper" ...>通过重命名“纸”类,空页面消失了!
<div class="A4 papir" ...>在类内容中没有任何变化!
发布于 2020-08-31 04:24:31
请验证您的内容的正确html标记。
我失踪了
</div>这导致显示空白页面。
https://stackoverflow.com/questions/30079142
复制相似问题