【问题标题】:mPDF pagination problem when using WriteHTML function使用 WriteHTML 函数时的 mPDF 分页问题
【发布时间】:2020-06-02 14:04:27
【问题描述】:

我有一个动态生成的 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】:

    尝试将setFooter 放在WriteHTML 之前

    所以,这样:

    $mpdf->setFooter('{PAGENO}/{PAGETOTAL}');
    $mpdf->WriteHTML($content);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 2012-03-17
      • 2019-07-28
      • 1970-01-01
      • 2019-10-25
      相关资源
      最近更新 更多