Replace part of PDF with PHP

I am considering options for creating an invoice and ordervoucher generator in PHP. I created several PDFs for other cases before with FPDF and TCPDF, and both work fine, but are sooooo verbose that it bothers me.

I get the feeling that generating PDF in any programming language is super verbose.

Is it possible to create a PDF project with Adobe Acrobat and use it as a template with variable fields / areas? Thus, I could, for example, allow designers to overcome, create a blank and a general invoice topic for me, and I would only write the contents of the variable parts (order lines, totals, date, customer details) in pdf.

Simply put, a template system for barebones that reads pdf and displays it again after changing variables.

+5
source share
4 answers

You can create a PDF file with form fields and replace the contents of these fields in the source. You must replace the exact number of characters, otherwise the PDF may be damaged. In your case, when you want to add whole tables, this may not be possible.

We did something very similar, but took a different approach. Using http://www.setasign.de/products/pdf-php-solutions/fpdi/ , we downloaded the PDF file and placed the content we wanted on top (FPDI extends TCPDF or FPDF).

+4
source

You can use the free Zend PDF module: http://framework.zend.com/manual/en/zend.pdf.html

. PHP: PDF PHP?

FPDF PDF , ( - : http://www.fpdf.org/

+1

- (, FPDF) PDF . /dev/null, .

+1

, . PDF :

AcroForms: , , Acrobat 4.x 5. . PDF AcroForm.

XFA: . Adobe LiveCycle Designer ( Acrobat Pro) , ... Adobe. Adobe .

PDF du jur PDF . PDF "" , , PDF PDF. , , ( , , ).


There are also quite a few HTML-> PDF libraries floating around. You can create your reports in HTML, and then translate them into PDF, if you prefer to go along this route. Some of them are better than others, and only one that I know of will take into account the HTML script (wkhtmltopdf).

+1
source

All Articles