开发者

How can I reduce time to generate PDF dynamically using PHP?

I am gener开发者_JAVA技巧ating PDF dynamically using html2ps PHP library. I want to decrease time of generating that PDF .I want to reduce that PDF generation time .Is there any way to reduce the time or optimize it?

Help me please.


Are you running this code on recent hardware?

While it may sound like avoiding the solution, on the Coding Horror Blog (whom happens to be the guys who made this site) they preach that you shouldn't spend time tweaking performance if your hardware is limited.

If you're doing this on a single core CPU (ex: Pentium 4), you are wasting your time worrying about what library to use or what code to change. Even the slowest Core 2 Duos and newer AMDs start at 2x faster than the best Pentium 4.

PS: I wasn't able to find the article on their site to link for you.

PPS: Most Pentium 4 motherboards support the 65nm Core 2 Duos.


One method of optimizing is to try another library. I use dompdf when I need to convert HTML to PDF, and I haven't found any need for optimizing, it's very fast, supports CSS properly and produces accurate results.


  1. Reduce the complexity of the output.
  2. Reduce the output quantity.
  3. If the PDF generation is impacting other operations, delegate it to another process or server.


I'm sure you can avoid a lot of processing by skipping the HTML/CSS step(s) and go directly to PDF. Check FPDF or PDFLib

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜