This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Increase PDF generation throughput

smallimpdev wrote on 2013-05-03:

so we want to generate many PDFs at a time. We can call the api with just one html at a time, but currently it takes about 7 seconds per html. Out html render to one pdf page, they all have the same structure, include the same css and javascript, only images are different for each.

How can we optimize this or get a batch generation?

I imagine we could embed the css and javascript, and even embed the images in the html file to avoid all additional requests pdfcrowd would make. is this recommended? Is there any other way we can get higher throughput?

support wrote on 2013-05-06:
Hello Thibault,

Embedding minified css and javascript may help.
We do not recommend embedding images unless there is a lot of them and they are smaller than 1KB.

In our experience, most often the bottlenecks are the following:

  • Slow generation of the HTML document itself on the client side (slow DB query, ...)
  • Static assets are loaded from a slow or misconfigured server.

If you post here a link to your document we can do a quick check to see if there is anything obvious.
smallimpdev wrote on 2013-05-06:
Hi, thanks,

Here is the html and a corresponding PDF file, with dummy data.

We can try whether minified and embedded css and javascript significantly reduces generation time, if so we'll post the results we get.

support wrote on 2013-05-09:
Hello Thibault,

I don't know how far you got with this but according to our investigation it seems that the dynamic stylesheet is a significant contributor to the total time.