views:

48

answers:

4

We currently use PDForm to grab a blank pdf file (no values, just form fields and text) and list the form fields. We then query our database for the values which match those field names and create a pdf file with the newly populated data which the user can download from our site. The thing is PDForm is about $5,000 per machine and we are migrating servers. We want an alternative which is actively supported and recommended by the community.

I know Zend is working on a PDF manipulation extension, but we need something quick. I have done testing with PDFtk but the last update for that project was in 2006 and it now seems dead. It would be fine as it is open source, however it seems to be causing errors with certain files that seem to be generated with PDFPenPro (our pdf form creator).

Another solution I thought up was why not just use iText and write a java wrapper which accepts command line input, so that PHP can call it with passthru() or exec(). There are other applications that will work should we completely rewrite our code but we do not want to do that.

What we need.

  1. The ability for PHP to receive the PDF form field names.
  2. PHP to then either create and FDF file (then merge it with the PDF) or send a string to a command line application which will populate the fields with values from our database.
  3. The user can then download the newly created PDF file with the populated form fields.

Am I moving in the write direction by creating a java command line application that will use iText to parse and create the PDF files specified by PHP or does anyone know of any cost effective alternatives?

A: 

I don't know if another product whose license costs range from $1k -> $3k could be considered "cost effective", but PDFlib work quite nicely. And if you don't need the PPS functionality, it does get cheaper.

Marc B
We had looked at PDFLib but do not find it cost effective as we will need a license for our Production server, Development server and our local dev environments which means we will need about 7 different licenses.
jostster
Actually, you're allowed to use PDFlib on as many development machines as you want, as long as only devs have access and it's on the same OS as the production machine. http://www.pdflib.com/fileadmin/pdflib/pcos-cookbook/pdf/PDFlib-license.pdf. But otherwise, yeah, it is a fairly pricey chunk of code.
Marc B
You're right. I was thinking of something else. The reason we decided not to go with PDFlib was because it didn't edit the form fields but instead converted the form fields into blocks. We need the fields to remain intact so that should we need to add more information to the pdf fields after it is created we can.
jostster
A: 

TCPDF seems to have the most robust feature set that I have seen so far.

d2burke
I looked at TCPDF but did not see any options for obtaining a list of all the form fields as well as populating the existing form fields with values. Did I overlook something?
jostster
+1  A: 

Thanks, d2burke, for the tip on TCPDF. I'm not trying to do quite as much as the OP, but the software packages available to accomplish any kind of pdf generation are in the $2k to $3k range. TCPDF is php based, open source and the guy developing it is very supportive.

Always donate to these guys! Where in the world would web development be without it?

Ricalsin
A: 

So since none of the above solutions would work since TCPDF doesn't work with forms the way we are wanting and since PDFlib converts the form fields to blocks we decided to create a command line wrapper for iText which will grab the form field names from the PDF and then populate them based on the database values.

jostster