【发布时间】:2015-11-13 10:54:32
【问题描述】:
我正在研究 PHP,Codeignitor。我有一个可编辑的pdf。我想填写 pdf 中的空白,例如名字、姓氏、电子邮件。我在 php 中使用 FPDF 和 FPDI。首先,我包含 fpdf 和 fpdi 文件。 创建一个函数。我的代码如下。我已经创建了 FPDI 的对象。
$pdf = new FPDI();
$pdf->AddPage();
$path = base_url().'uploads/test.pdf';
$pdf->setSourceFile($path);
// import page 1
$tplIdx = $this->pdf->importPage(1);
//use the imported page and place it at point 0,0; calculate width and height
//automaticallay and ajust the page size to the size of the imported page
$this->pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
// now write some text above the imported page
$this->pdf->SetFont('Arial', '', '13');
$this->pdf->SetTextColor(0, 0, 0);
//set position in pdf document
$this->pdf->SetXY(20, 20);
//first parameter defines the line height
$this->pdf->Write(0, 'gift code');
//force the browser to download the output
$this->pdf->Output('gift_coupon_generated.pdf', 'D');
请帮助我。
【问题讨论】:
标签: php codeigniter pdf fpdf