【问题标题】:How to add custom header and footer in laravel tcpdf?如何在 laravel tcpdf 中添加自定义页眉和页脚?
【发布时间】:2016-09-22 10:29:33
【问题描述】:

如何使用 laravel 控制器在 tcpdf 中添加自定义页眉和页脚文本

按照TCPDF doc,我可以很好地创建一个pdf文件。但是当我想添加自定义页脚文本时,我没有这样做。 这是Controller。

如何在 tcpdf 中添加自定义页脚,或者您有任何自定义页脚的解决方案,我将轻松使用自定义页脚的任何其他包,请建议我。

【问题讨论】:

    标签: pdf pdf-generation laravel-5.1 tcpdf makepdf


    【解决方案1】:

    我使用 mPdf 而不是 tcpdf 解决了我的问题。使用 mPdf 我刚刚调用了 SetFooter() 函数。

    $mpdf = new mPDF();
    
    $mpdf->Bookmark('Start of the document');
    
    $mpdf->WriteHTML('<div>This is body text </div>');
    $mpdf->SetFooter('<div>This is custom footer!</div>');
    
    $mpdf->Output();
    

    现在自定义页脚对我有用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-27
      • 1970-01-01
      相关资源
      最近更新 更多