I'm looking at the options for building an invoice and ordervoucher generator in PHP. I've created several PDF's for other occasions before with FPDF and TCPDF and both work fine but are sooooo verbose that i'm getting sick of it.
I get a feeling that generating PDF's in any programming language is super verbose.
Is there any way at all to generate a PDF-blueprint with Adobe Acrobat and use that as a template with variable fields/area's? That way i could for example allow the designers overhere create me a letterhead and overall invoice theme and i would only write the content of the variable parts (order lines, totals, due date, buyer details) into the pdf.
To put it simple, a barebones templating system that reads a pdf and outputs it again after variable substitution.
You can create a PDF with formfields and replace the content of those fields in the source. You have to replace the exact number of characters though, otherwise the PDF might get corrupted. In your case, where you want to add whole tables, that might not be feasible.
We did something very similar but used a different approach. Using http://www.setasign.de/products/pdf-php-solutions/fpdi/ we loaded the PDF, and put the content we wanted on top (FPDI extends TCPDF or FPDF).
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki