更新:我看到最近人们对此表示赞同,并希望补充一点,对于大多数应用程序来说,wkhtmltopdf可能是更好的选择.
基本上,你先创建PDF模板,然后将其加载到新FPDI对象,并使用FPDF功能绘制"在"模板 - 就像Photoshop图层工作.
$pdf = new FPDI();
$pdf->setSourceFile('template.pdf');
$tpl = $pdf->importPage(1);
$pdf->addPage();
$pdf->useTemplate($tpl); <- template is imported
$pdf->setXY(10, 20);
$pdf->write(100, "Hi there"); <- write or draw something on the template
$pdf->output('newpdf.pdf', 'D'); <- ready, save or output your pdf
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3576 次 |
| 最近记录: |