此代码从 html 创建一个 pdf。这是一个例子。如何使第二页的背景图像像第一页一样?
$mpdf = new mPDF('utf-8','A4','8','',10,10,22,22,10,20);
$html = '<div id="for_pdf">
<h3>some text</h3>
...
<h3>some text</h3>
</div>';
$stylesheet = file_get_contents('./static/css/print.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->list_indent_first_level = 0;
$mpdf->WriteHTML($html,2);
$mpdf->Output("$doc_name.pdf",'D');
print.css 文件的一部分:
#for_pdf{
background-image: url("/static/image/pdf_img/big_logo.gif");
background-repeat: no-repeat;
background-position: center;
}