Generating PDFs with PHP

Luiz Guilherme picture Luiz Guilherme · Nov 5, 2008 · Viewed 8.9k times · Source

I have a PHP application and a need to generate a PDF with the result of query. The easiest way a found to do this was to use the DOMPDF to generate the PDF for me. So a made a function that generates the HTML for me then a pass this to DOMPDF. In the development and testing enviroment everything was fine but on production enviroment I had some problems with memory usage.

So I would like to know if my strategy was the best one or if there's a better and easy way to do this.

How would you do that?

Answer

vIceBerg picture vIceBerg · Nov 5, 2008

I once did a PHP project generating PDF. I used FPdf.

I never had any memory problems. It's free, it's pure PHP code. You don't have to load any extensions.

I don't know if there's some helpers to auto-generate document from a query, but in the website, you have some scripts that shows how to use it with MySql.

HTH