Looking for a fast library to render PDF's files with PHP
Solution 1
In terms of performance wkhtmltopdf seems to be doing well.
It does not rely on PHP to do the heavy lifting, but instead it uses the webkit-engine to render the page.
The downside is that it has not been updated in a while.
Solution 2
Have you tried 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 : class which allows to generate PDF files
You can also use FPDI with FPDF. With FPDI you will be able to import single pages of existing PDF documents into templates.
Solution 3
I use it and its very good, flexible, you can set size of a page, you can also use template (fpdi - works with fpdf). You can put images, text, set position of each element.
Solution 4
Some benchmark results:
To renderer this file (with only plain divs) http://dl.dropbox.com/u/15451865/notables_dompdf.html on Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz, 8 GB RAM memory (Ubuntu 12.04):
Dompdf: 35 seconds with a CPU rate of 100%
Google Chrome PDF printer: 1 seconds
So I think DOMPDF is an amazing library but for a service which needs high performance I need another library (I'll try FPDF).
alasarr
Software engineer. HTML5 And Cloud developer. System administrator
Updated on July 10, 2022Comments
-
alasarr almost 2 years
Does anyone knows about a fast library to render PDF's files with PHP?
I'm trying with dompdf but it's really slow, it takes about 5 minutes to render a PDF of 23 sheets.
Dompdf is amazing and really useful, but when you've to render large pdf's files is worthless.
I'm using dompdf 0.6.0 beta 3.
Has anyone experimented with larges pdfs in php using another library?
Could I improve this with dompdf? Here is the html file which dompdf renders:
http://dl.dropbox.com/u/15451865/pdf.html
I'm thinking about to write a service with openoffice library but I don't like to use another technology only for this.
-
alasarr almost 12 yearsThanks, I'm going to test it and I'll post my results
-
Simon Bengtsson almost 10 yearsI html table with minimal content and 200 rows times 5 columns took almost 20 seconds to load. I realize this is an old answer, but did you have any luck with FPDF?
-
baldrs about 9 yearsYes, you just forgot to mention it needs running X server running server-side and performance is awful.
-
Marcel Djaman almost 8 yearsperformance awful? not sure at all! One of best pdf convertor library