Php 如何使用mPDF获取已创建PDF的最后一页

Php 如何使用mPDF获取已创建PDF的最后一页,php,mpdf,Php,Mpdf,我想在运行时使用mPDF创建PDF文件的最后一页上打印一些行 我可以展示一些mPDF库中的工作示例或代码,这样我就可以轻松实现 下面是我的PHP源代码,运行良好,但我想在PDF文件的最后一页上写一些文本 $mpdf = new mPDF(); $html = file_get_contents('../styles/uploads/files/extract/'.$bookName.'/'.$bookName.'_coverFinal.php'); $html = iconv("UTF-8","

我想在运行时使用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");

谢谢。

我希望我正确地理解了您的意思:

$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只是一个字符串

,为此,您需要使用
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");