For several recent projects I’ve been called upon to produce output in PDF format. For a PHP coder the difficulty lies not in the task itself, but in choosing which of the numerous PDF generation libraries to use.
I’ve tried several over the past 18 months or so, including FPDF and TCPDF. TCPDF is a direct wrapper for PDF functions, which means getting your head around PDF’s layout behaviour — powerful but rather time-consuming. TCPDF does the same but also provides the ability to import HTML documents — much easier, but unfortunately not as stable as one might hope: in particular I had problems with elements (e.g. tables) that spanned pages.
For my most recent project I’ve been experimenting with dompdf, which does away almost entirely with the notion of directly interacting with PDF layout in favour of attempting to provide more robust and flexible HTML import. As such it has impressively advanced CSS support, as well as excellent handling of tables and other markup. The documentation is somewhat lacking so in some cases it’s necessary to dig around in the support forum to find out what you need. But so far I’d say it’s by some margin the best of the libraries I’ve tried.