开发者

Fastest PDF generation in PHP?

I'm attempting to generate some reports dynamically, very simple HTML tables with borders.

I've tried TCPDF and it renders up to 400 r开发者_如何学Goows just fine but anything more than that (about 20 pages) it can't handle it. DOMPDF can't even do that.

These reports can be thousands of rows.

Any idea on a faster library or a better plan of attack?


Try php-wkhtml2x php extension. It uses popular web engine webkit(Chrome and Safari uses that)


I use the FPDF library, the output is fast and resource-efficient. Try it out... http://www.fpdf.org/


I don't know if these methods are the fastest, but they can certainly handle more than 20 pages.

You could use latex in combination with php: http://www.linuxjournal.com/article/7870

or Zend_Service_LiveDocx_MailMerge http://www.phphatesme.com/blog/webentwicklung/pdf-erzeugung-mit-dem-zend-framework/


Try DocRaptor.com. It's a web-based app that converts html to pdf. Easy to use.


It's possible that depending on the report that PHP is not the right solution you and might consider another alternative language such as perl to accomplish this. I have no experience with other server-side languages but it is something to keep in mind. Definitely follow @Pekka's advice and determine the limits and work on adjusting those.


Fact Thousands of rows can be handled by the php.

My assumption

Most probably you will be fetching data from db and saving to an array and then you will be looping to write the rows.

This will eat memory.

My suggestion

Try to write into the pdf at time of fetching from db. remove the step of storing into an array.

check execution time and memory allocated in php ini.

At last when you generate it , think PDF can handle it or not :-) surely It will have huge size .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜