Awhile back, (awhile being a few years now) Anthony and I wrote a document processing system in PHP for the company. It takes in XML data and merges this with OpenOffice documents as templates to create final dynamic merged PDF documents for printing, email, and storage on disk. It has been running ever since, processing a few hundred documents a week.
This system actually replaced another one that did close to the same thing, but required Microsoft Word, licenses for Office, and multiple servers and Windows installations and .NET programming. It was horrible, slow, and unstable. Which lead us to create the new system.
A few days ago I was asked to add another template to the server, which happens a few times a month. But this time the document to be added was a PDF file already, very complex actually. Having multiple form fields and such. I tried to recreate / convert it to OpenOffice but it always comes out ugly. So instead of working around this, I went ahead and added some more code to the program to take in the XML data as usual, and for this one document (or more in the future) to merge FDF data into the PDF.
Searching around where to start, and found a good site: http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.html which gave some very useful information. What I really needed was the php function he offers here: http://www.pdfhacks.com/forge_fdf/. Take a look, it’s kinda neat.
It is in production now, and working very well!