Creating PDF’s on the fly using PHP and TCPDF

I’ve got a separate website that used to offer a service where you could get a custom report in the form of a PDF sent to you.  For that I used a free open source PHP script/library called FPDF.  It’s reasonably well documented, but there are a lot of nuances that not really intuitive.  Used in combination with a script called FDPI for importing an existing PDF’s, mixing in a little data from users, databases, and the internet, and it was a pretty amazing thing.

An acquaintance of mine suggested I take a look at a similar library for creating PDF’s with PHP called TCPDF.  The documentation borders on the compulsive – which I sincerely appreciate.  While the immediate downside is that it does not have a built-in PDF importer, it is apparently compatible with the aforementioned1 FDPI.  The part that I really like about TCPDF from scanning through these examples is the robust HTML rendering engine.  It would be a really amazing to be able to dump a chunk of HTML directly into a PDF without having to design a script to read through it all, parse it, and then format it specifically for the PDF.

  1. Who the hell uses THIS freaking word?! []
October 23, 2011 | Comments Closed

Comments are closed.