Dynamic Generation of PDFs with FPDF/FPDI
Development, PHP July 6th, 2007
In a recent project I needed to build quite a few dynamic pdfs, with information filled from a database. This led me to two great pieces of PHP code, FPDF and FPDI. FPDF allows for building new pdf documents from scratch, while FPDI allows for manipulation of already existing pdf documents. FPDI is an extension of FPDF, so utilizing both is a minor triviality.
FPDF:Utilizing FPDF/I I was able to build a 32 page dynamic pdf set over a couple of days. Needless to say, both FPDF and FPDI are very handy tools, and have an amazing amount of potential.
FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression) and works with PHP4 and PHP5.
FPDI:
FPDI extracts and imports single pages of existing documents into FPDF. The resulting PDF created by FPDF/FPDI is a completely new document. Please don't misunderstand: with FPDI you cannot edit a PDF.
Nicholas Alston
PHP just becomes greater by the day!
Can you build a little how-to-tutorial? I have a form, when you post the form it should put everything in PDF… I want to use FPDF and FPDI, but haven’t got a clue how-to do it… :$