html2pdf如何在每个页面中添加页脚?

时间:2017-05-11 12:41:34

标签: php tcpdf html2pdf

我已经完成了他们的例子,但在我的情况下,我包含了大量的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");

0 个答案:

没有答案