[使用WriteHTML函数时的mPDF分页问题

问题描述 投票:0回答:1

我有一个动态生成的HTML内容,并希望使用mPDF生成页码PDF。问题在于,当内容跨越多个页面时,页脚仅在最后一页中可见。

示例:

$mpdf->AliasNbPages('{PAGETOTAL}');
$mpdf->WriteHTML($content); // $content is dynamic, it can be a series of paragraphs resulting in a 3 or 4, or more, pages long pdf.
$mpdf->setFooter('{PAGENO}/{PAGETOTAL}'); // this only prints a footer in the last page, displaying for example "3/3", but the previous pages do not have footer

我想在每页中添加页脚,但我事先不知道会有多少页或分页符在哪里。

我做错什么了吗?

php mpdf
1个回答
0
投票

尝试将setFooter放在WriteHTML之前

所以,这种方式:

$mpdf->setFooter('{PAGENO}/{PAGETOTAL}');
$mpdf->WriteHTML($content);
© www.soinside.com 2019 - 2024. All rights reserved.