devongovett / node-wkhtmltopdf

A wrapper for the wkhtmltopdf HTML to PDF converter using WebKit
606 stars 147 forks source link

Pdf Generation for large html file takes too long #123

Open mohammedfariz opened 5 years ago

mohammedfariz commented 5 years ago

I am using wkhtmltopdf for generating pdf file from html file with Node JS. If the html file is too large (In my case its about 55 MB), then the pdf generation part is taking too long (More than 10 minutes)

Is there any way to optimize the time ?

My system Configuration is : OS : Windows 10 64 bit Ram : 8 GB Processor : i5

PyroSA commented 5 years ago

Check your memory usage while it generates. I can't recall specifics, but larger documents consumed gigabytes of memory, and the issue lies with wkhtmltopdf, not this library.

The issue seemed to be with large documents, not the content. Generating 1000 pages one-by-one would be fast, but generating them at the same time would crush the system.

rmjjjt commented 5 years ago

I have been having this issue recently - tried so many different things with no luck. Then I came across this article about css rendering time. I had no border-radius in to remove, but I did have box-shadow on every page. I replaced the box shadow with a plain border and the pdf rendered almost instantly. It may be worth checking your css for time consuming styles.