【问题标题】:Blank PDF is generated is number of pages exceeds 17生成空白 PDF 是页数超过 17
【发布时间】:2013-07-29 10:10:05
【问题描述】:

在某些情况下,当我使用 tcpdf 生成 PDF 时,我得到一个空白页。如果页数小于 17,它将正确生成文件。如果它更大,将生成一个空白的 pdf 页面。这是我的代码

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(0,5,0,0);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setPrintHeader(FALSE);
$pdf->AddPage('L', 'A4');
$pdf->SetFont('arialuni','',10);
$pdf->writeHTML($Content, true, 0, true, true);
$pdf->lastPage();
$pdf->Output('example.pdf', 'I');

【问题讨论】:

    标签: pdf-generation tcpdf


    【解决方案1】:

    PHP脚本需要allow maximum execution时间。

    PHP.ini 中设置最长执行时间。 Link

    如果它不起作用,请在 PHP 脚本顶部添加 set_time_limit(0);

    【讨论】: