【问题标题】:Dynamic Footer MPDF动态页脚 MPDF
【发布时间】:2014-11-27 21:45:12
【问题描述】:

我正在使用 mdpf 和 php 生成 PDF。每次使用标签分页符时,我都需要创建不同的页脚。

我的代码是这样的(但它不是这样工作的)

$mpdf = new mPDF('c', 'A4');
$mpdf->SetHTMLFooter('First Article','O');
$html = 'Lots of text';
.
.
.
$html .= "pagebreak"; (this is a html tag)
$html .= 'More lots of text';
$mpdf->SetHTMLFooter('Second Article','O');

$mpdf->WriteHTML($html);
print $mpdf->Output();

我该怎么做?

【问题讨论】:

  • 您好,您的问题不清楚。你想设置什么不同的页脚?为什么不使用SetHTMLFooter为每个页面设置页脚

标签: php footer mpdf


【解决方案1】:

你需要用WriteHTML刷新内容,然后设置一个新的页脚。

$mpdf = new mPDF('c', 'A4');
$mpdf->SetHTMLFooter('First Article','O');
$html = 'Lots of text';
.
.
.
$html .= "pagebreak"; (this is a html tag)

$mpdf->WriteHTML($html); //flush

$html .= 'More lots of text';
$mpdf->SetHTMLFooter('Second Article','O');

$mpdf->WriteHTML($html);

print $mpdf->Output();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 2023-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-10
    • 2014-10-13
    相关资源
    最近更新 更多