【发布时间】:2012-05-23 13:57:24
【问题描述】:
我正在使用 FPDI 来编辑我现有的 pdf 文件,它的工作非常适合单页。
如您所见,我正在编辑我的$tplIdx = $pdf->importPage(1); 第一页。
我有六页的 pdf 文件,需要在不同的页面中添加 2 个变量。
有可能吗?怎么样?
<?php
require_once('fpdf.php');
require_once('fpdi.php');
// initiate FPDI
$pdf = new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('ex.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 10, 10, 200);
// now write some text above the imported page
$pdf->SetFont('Arial');
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(50, 50);
$pdf->Write(0, "Ajay Patel");
$pdf->Output('newpdf1.pdf', 'D');
?>
提前致谢!
【问题讨论】:
-
@JA 我已经导入了 6 页 pdf 文件并且输出是单页,我想要所有页面