【问题标题】:How to get the last page of created PDF using mPDF如何使用 mPDF 获取创建的 PDF 的最后一页
【发布时间】:2014-09-22 23:43:31
【问题描述】:

我想在运行时使用 mPDF 创建 PDF 文件的最后一页打印一些行。

任何人都可以从 mPDF 库中展示一些任何工作示例或代码片段,以便我轻松实现。

我的 PHP 源代码在下面,它运行良好,但我想在我的 PDF 文件的最后一页上写一些文本。

$mpdf = new mPDF();
$html = file_get_contents('../styles/uploads/files/extract/'.$bookName.'/'.$bookName.'_coverFinal.php');
$html = iconv("UTF-8","UTF-8//IGNORE",$html);
$mpdf->WriteHTML($html);
$mpdf->Output(dirname(__FILE__)."/../styles/uploads/files/pdf_files/PDF_Book_".$var.".pdf", "F");

谢谢。

【问题讨论】:

    标签: php mpdf


    【解决方案1】:

    希望我理解正确:

    $mpdf = new mPDF();
    $html = file_get_contents('../styles/uploads/files/extract/'.$bookName.'/'.$bookName.'_coverFinal.php');
    $html .= 'your html here';
    $html = iconv("UTF-8","UTF-8//IGNORE",$html);
    $mpdf->WriteHTML($html);
    $mpdf->Output(dirname(__FILE__)."/../styles/uploads/files/pdf_files/PDF_Book_".$var.".pdf", "F");
    

    到底$html只是一个字符串

    【讨论】:

      【解决方案2】:

      为此,您需要使用 WriteHTML() 函数。这样您就可以在 pdf 中添加页面上的文本

      $mpdf = new mPDF();
      $html = file_get_contents('../styles/uploads/files/extract/'.$bookName.'/'.$bookName.'_coverFinal.php');
      $html .= 'the content which you want to add to';
      $html = iconv("UTF-8","UTF-8//IGNORE",$html);
      $mpdf->WriteHTML($html);
      $mpdf->Output(dirname(__FILE__)."/../styles/uploads/files/pdf_files/PDF_Book_".$var.".pdf", "F");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-10-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多