我想将我的html页面转换为使用mpdf的pdf格式。问题是,我无法应用多个CSS来PDF文件 ..这里是我的PHP如何在mpdf中添加多个css文件
<?php
$html =file_get_contents('mpdf/test.html');
include("../mpdf.php");
$mpdf=new mPDF();
$mpdf->SetDisplayMode('fullpage','two');
// LOAD a stylesheet 1
$stylesheet = file_get_contents('assets/css/main.css');
$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
// LOAD a stylesheet 2
$stylesheetextra = file_get_contents('assets/css/test.css');
$mpdf->WriteHTML($stylesheetextra ,1); // The parameter 1 tells that this is css/style only and no body/html/text
$mpdf->WriteHTML($html,2);
$mpdf->Output();
exit;
?>
输出它给人不附带test.css的代码。 main.css正确地应用于pdf文件,但test.css不适用。请帮助我吗? 预先感谢您
不追加第二样式表的第一项工作,即$ =样式的file_get_contents(资产/ CSS/main.css的“ )。的file_get_contents( '资产/ CSS/test.css'); $ mpdf->的WriteHTML($样式表中,1); – jeff