简体   繁体   English

用PHP大量生成PDF

[英]Large amount of PDF generation in PHP

We are generating pdf based report cards for our clients on a php based ERP platform. 我们正在基于php的ERP平台上为客户生成基于pdf的报告卡。 They want to be able to generate around 2000 report cards one pdf file as seperate pages. 他们希望能够生成约2000个报告卡,其中一个pdf文件作为单独的页面。

We have done this successfully using an HTML to PDF converter called DomPDF. 我们已经使用称为DomPDF的HTML到PDF转换器成功完成了此操作。 However the script is too heavy and takes about an hour to complete and sometimes breaks, which is unacceptable. 但是,脚本太重,大约需要一个小时才能完成,有时会中断,这是不可接受的。 They currently used a desktop based software which delivers the report cards instantly via Crystal Reports. 他们当前使用的是基于桌面的软件,该软件可通过Crystal Reports立即发送报告卡。

In PHP we were wondering how we could generate such a large number of PDF pages (2000) with a much a higher speed.(hopefully less than 10 seconds). 在PHP中,我们想知道如何以更高的速度(希望少于10秒)生成如此大量的PDF页面(2000)。

Any suggestions for this would be welcome. 任何对此的建议都将受到欢迎。

The server is running on Linux Ubuntu, we dont mind using a solution that involves use of exec. 该服务器在Linux Ubuntu上运行,我们不介意使用涉及使用exec的解决方案。

使用WKHTMLTOPDF生成包含450至500页(仅2 MB文本)的PDF报告需要30至50秒,而TCPDF或HTMLTOPDF或DOMPDF中相同数量的数据则需要5至8分钟

我们一直在使用wkhtmltopdf -utility做得很好,但是我不确定它是最快的。

If you want to generate the PDFs from HTML, I would recommend using WKHTMLTOPDF via exec() or system(). 如果要从HTML生成PDF,我建议通过exec()或system()使用WKHTMLTOPDF We're using it in some applications and haven't had any problems at all so far (but neither do we generate the same amount of data as you guys). 我们正在某些应用程序中使用它,到目前为止还没有任何问题(但是我们生成的数据量也没有你们那么大)。

Or Maybe Try the i-report designer. 或者也许尝试i-report设计器。 I had used it once and its great but you need to read forums or tutorials for customization and one thing about this is its an Open source, hope it would help you. 我曾经使用过它,但是它很棒,但是您需要阅读论坛或教程进行自定义,与此有关的一件事是它的开源,希望对您有所帮助。

http://community.jaspersoft.com/project/ireport-designer http://community.jaspersoft.com/project/ireport-designer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM