I actually have been living with this for awhile but realized that it is just getting unbearably slower over time. It takes approximately 30s to generate any PDFs for any documents including Sales Orders, Invoices etc. I run ERPNext on Ubuntu and based on a simple version check have wkhtmltopdf 0.12.2.1 (with patched qt).
demo.erpnext.com generated PDFs in 1 or 2 seconds. Anyone encountered similar problems?
I find it quite strange, cause I’ve even tried to push the HTML output to a file then created a standalone python file and within this app I pull the contents of the HTML output into a string then ran the same pdfkit.from_string command and it seems to run fast. Although the output is not as nicely formatted as if I had generated from ERPNEXT.
dont think that would help to be honest. Can you help me with something, can you share your output when running “wkhtmltopdf --version” and would you mid sharing whether you are using 32 or 64 bit for ubuntu?
Are you running it on a desktop with a GPU or on a server?
@rmehta yea, I too think thats the best way forward … have been trying to search for similar problems for days no to avail, will post an issue on the wkhtmltopdf forum and will share the results once I get them
I cannot believe I missed this all this while, for Ubuntu there is reduced functionality and some dependencies need to be installed. I think perhaps one or two were missing or misbehaving. I reinstalled them and its back to normal!
I find it quite strange that it would behave this way especially since I used the installation script provided to install ERPNext. Anyhow, for anyone who has problems with Ubuntu PDF generation performance you can try this.
@pdvyas thanks for the explanation. Will try your suggestion if I ever hit this problem again.
The link you provided clarifies alot.
Just for my information, may I know from your experience why would an unset $HOME cause the font cache to not be available? or cause the system to want to re-cache the fonts?
We had the same problem whereby PDF generation was taking longer and longer by the day. It got to the point that it was taking more than 30 seconds just to create a single PDF!
bohlian seems to have the perfect solution (for Ubuntu Server 14.04 at least)
SSH onto your Server and run the commands as suggested: