How to optimize wkhtmltopdf for speed?

3,637 views
Skip to first unread message

Ville Mattila

unread,
Jul 16, 2013, 3:16:59 PM7/16/13
to wkhtmltop...@googlegroups.com
Hi,

I need to generate many small PDF files from HTML sources and now looking possibilities to optimize wkhtmltopdf to run as quick as possible. My source HTML documents contain just very simple HTML, a few CSS definitions and some images.

Already now I have done following:
- feed the source HTML over stdin and receive via stdout
- whenever possible, embed the image as inline code (<img src="data:...." />)
- use local HTTP proxy to avoid network lookups

Command line flags used to invoke the wkhtmltopdf process are currently "-B 0 -T 0 -R 0 -L 0 --disable-smart-shrinking --exclude-from-outline --disable-javascript --disable-internal-links --disable-external-links --no-background --no-outline".

What other flags could I add to the process to speed up the process? Is there some other tricks (for example running the whole wkhtmltopdf as a daemon somehow) that I could utilize?

Best regards,
Ville

Ish Kumar

unread,
Mar 3, 2015, 5:10:24 PM3/3/15
to wkhtmltop...@googlegroups.com
I was running into same problems and ended up using --print-media-type , you loose normal css styling but it's amazing fast.
Reply all
Reply to author
Forward
0 new messages