我有一个动态生成的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
我想在每页中添加页脚,但我事先不知道会有多少页或分页符在哪里。
我做错什么了吗?
尝试将setFooter
放在WriteHTML
之前
所以,这种方式:
$mpdf->setFooter('{PAGENO}/{PAGETOTAL}');
$mpdf->WriteHTML($content);