gpt4 book ai didi

php - mpdf addPage 创建空白页

转载 作者:太空宇宙 更新时间:2023-11-04 12:15:38 31 4
gpt4 key购买 nike

您好,当我尝试在 for 循环中使用 $mpdf->addPage() 时,没有创建包含内容的新页面,而是创建了一个空白页面。我想在达到一定条件后打破页面,然后在创建新页面后添加内容。这是代码流程的粗略概念。

$form = '<html head informatio here >';
$mpdf->WriteHTML($form);

$form .= '<html body content which is essentiall a nested table >'
within this section i have a for loop
for ( $i=0; $i < $rows; $i++ ):
$mpdf->WriteHTML($form);
at certain points I would do a
$mpdf->AddPage();
endfor;

$form .= '<html footer information >'

$mpdf->WriteHTML($form);

结果是所有内容都放在 pdf 的最后一页,而我有大约 6 或 7 个空白页。任何帮助将不胜感激..

最佳答案

$form = '<html head informatio here>';
$mpdf->WriteHTML($form);
$form .= '<html body content which is essentiall a nested table >';

//within this section i have a for loop//

for ( $i=0; $i < $rows; $i++ ):
$mpdf->WriteHTML($form);

// at certain points I would do a //

//$mpdf->AddPage();

$form .= '<div style="page-break-after:always"></div>';

$mpdf->WriteHTML( $form);

endfor;

$form .= '<html footer information >';


$mpdf->WriteHTML($form);

关于php - mpdf addPage 创建空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28741874/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com