【发布时间】:2018-12-07 22:49:28
【问题描述】:
我有这段代码使用 TCPDF 创建 pdf 发票,它运行良好。我现在需要将另一个 pdf 的内容添加到最后一页。
我找到了使用 FPDI 的服务器示例,但无法确定如何将其合并到下面的代码中。
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Harlyn Enterprises');
$pdf->SetTitle('');
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
//$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
//$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// create first page
$pdf->AddPage();
$html = "html code for page 1 in here";
$pdf->writeHTML($html, true, false, true, false, '');
// create second page
$pdf->AddPage();
$html = "html code for page 2 in here";
$pdf->writeHTML($html, true, false, true, false, '');
$pdf[$site]->lastPage();
//Close and output PDF document
ob_clean();
$file = $_SERVER["filename.pdf";
$pdf->Output($file, 'F');
任何帮助将不胜感激。
【问题讨论】: