简体   繁体   中英

Generating PDF with Zend Framework 1 or 2

I have a template PDF that has one page and on that page there is an image. The template PDF is for print and is quite large (roughly 4000x4000 pixels @ 300ppi).

Using Zend Framework's PDF package I am overlaying the template with a PNG image, again quite large at about 4000x4000 pixels. Then saving the newly generated PDF out.

This is all fine, however it takes about 5 to 10 minutes! So my questions are:

  1. Why is it taking so long?
  2. Is it just the Zend PDF package that is slow at doing this, what other options are available?

I am running an Ubuntu Server with 4gb of RAM available on a virtual server (VirtualBox). The host, although I'm sure this is irrelevant, is a 16GB, 2.6Ghz Intel Core Mac Pro.

Thanks in advance.

It is taking long because in general, generating a PDF is a very expensive operation.

In your particular case one thing to consider is probably checking the allocated memory to PHP. You want to look into that and increase it for better performance given that is such a large file.

But I think maybe more relevant given that you are using a PNG you might want to look into this bug . This could highly relate to the issue you are experiencing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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