Creating PDF files in PHP
FPDF is a fairly simple OO PDF authoring tool, implemented in PHP. It comes with a load of documentation, tutorials, and tools, and made the development of my recipe "Export to PDF" facility easy.
The only complaint I have about the tool is in regards to it's documentation. While the authors have endeavoured to write readable, complete documentation on each of the methods exposed by the FPDF class, they missed one crucial element: what the method parameters mean.
Many of the methods take either co-ordinates or sizes (widths or lengths) as requisite parameters. But, nowhere in the documentation that I could find is there an explanation of how the co-ordinates or sizes are derived (what is the Origin, what are the measurement units). So, while I managed to compose a report layout that worked, it took a lot of trial-and-error, making educated guesses as to what the values should be, and making gradual, minor corrections to those guesses as they proved incorrect or inaccurate.
It only took a day (it should have only taken an hour or so), but I have success! I now have a clean, working "Export to PDF" function for my web-based recipe program.
Attachment | Size |
---|---|
Sample PDF from my recipe application | 10.91 KB |