We all love tech
Featured Articles
Dynamic PDF Generation with PHP
Oct 11th
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:
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.
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.
Recent Comments