Редактировать PDF на PHP?

Существует бесплатный и простой phtml в использовании класс PDF php-oop для создания документов PDF. Он php-readfile называется FPDF. В сочетании php-errors с FPDI (http://www.setasign.de/products/pdf-php-solutions/fpdi) можно даже редактировать php-errors документы PDF. В следующем phtml коде показано, как использовать php-cgi FPDF и FPDI для заполнения php-session существующего подарочного php-oop купона данными пользователя.

require_once('fpdf.php'); 
require_once('fpdi.php'); 
$pdf = new FPDI();

$pdf->AddPage(); 

$pdf->setSourceFile('gift_coupon.pdf'); 
// 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

pdf

2022-11-18T14:54:01+00:00