PDF Creation error

Hi All,
Any idea how to resolve this issue?

ERPNext: v13.16.1 (version-13)
Frappe Framework: v13.16.0 (version-13)
Ubuntu 18.04.2

         raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr))
OSError: wkhtmltopdf exited with non-zero code 1. error:
The switch --print-media-type, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.The switch --disable-smart-shrinking, is not support using unpatched qt, and will be ignored.QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-azzaz'
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display.

You’re using the wrong version of wkhtmltopdf. You need one with patched QT, refer to the following excerpt from this guide:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo apt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb
rm wkhtmltox_0.12.6-1.bionic_amd64.deb
2 Likes

It’s working, Thanks

But getting an error # 504 Gateway Time-out - nginx for a specific print format which have KSA VAT QR code.

Any idea?

Submit the invoice. Then generate the PDF.

Since in v13.16.1, the QR-code is generated after the Invoice has been submitted. If the QR is not generated you will get the aforementioned error.

thanks