【问题标题】:mPDF footer showing only on last pagemPDF 页脚仅显示在最后一页
【发布时间】:2015-08-06 13:50:01
【问题描述】:


我在生成 mPDF 页脚时遇到问题。 我正在使用 mPDF 和 nette 框架

<sethtmlpageheader name="default_head" value="1" page="ALL" show-this-page="1" />
    {include #content}
<sethtmlpagefooter name="default_foot" value="1" page="ALL" />

其中#content 是一个或多个表格。页眉在每一页上,但页脚仍然只在最后一页上,无论文档有多少页。 有人知道我可能做错了什么或忘记了什么吗?

提前感谢您的建议

【问题讨论】:

  • 我不确定,但也许你应该把&lt;sethtmlpagefooter&gt;放在内容前面。
  • omg...我现在讨厌自己...是的,成功了。谢谢大佬

标签: html footer mpdf nette


【解决方案1】:

我还有一个解决方案,您可以通过它仅在 mPDF 的最后一页上添加内容。 请按照以下步骤操作

  • 添加标题
  • 添加页脚
  • 编写您的 HTML
  • 再次添加页脚(仅显示在最后一页)
  • 输出
    $header = "Page header for all"; // Will be shown on all pages
    $footer = "Page footer for all"; // Will be shown on all pages
    $lastPageFooter = "Add New text for last page footer".$footer; // Adding new text

    $mpdf->SetHTMLHeader($header);
    $mpdf->SetHTMLFooter($footer);
    $html = $patientDetails . '' . $reportContent;
    $mpdf->WriteHTML($html);
    $mpdf->SetHTMLFooter(lastPageFooter);   // This will display footer for last page
    $mpdf->Output();

希望对你有帮助

【讨论】:

    猜你喜欢
    • 2016-07-24
    • 1970-01-01
    • 2018-10-03
    • 1970-01-01
    • 1970-01-01
    • 2013-11-18
    • 1970-01-01
    • 2021-01-18
    相关资源
    最近更新 更多