我已经完成了他们的例子,但在我的情况下,我包含了大量的html文档,所以我无法使用它
下面是我正在使用的示例代码
require(dirname(__FILE__).'/html2pdf-new/vendor/autoload.php');
//$pdf=new HTML2FPDF("P","mm","A4");
$pdf=new HTML2PDF("P","A4","en");
//$pdf->AddPage();
$file="pdfs/$id"."_test.html";
$fp = fopen($file,"r");
$strContent = fread($fp, filesize($file));
$pdf->WriteHTML($strContent);
//$pdf->AddPage();
$file="pdfs/$id"."_ptest.html";
$fp = fopen($file,"r");
$strContent = fread($fp, filesize($file));
$pdf->WriteHTML($strContent);
//$pdf->AddPage();
$file="pdfs/$id"."_ftest.html";
$fp = fopen($file,"r");
$strContent = fread($fp, filesize($file));
$pdf->WriteHTML($strContent);
$pdf->Output("pdfs/$subempid.pdf");