Pdf not printing

Whenever i give the print pdf command, there’s an error. It seems WKHTMLTOPDF error.

pls check the error code.

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 68, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 31, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 68, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1213, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/print_format.py”, line 95, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “apps/frappe/frappe/utils/pdf.py”, line 40, in get_pdf
filedata = pdfkit.from_string(html, False, options=options or {})
File “env/lib/python3.6/site-packages/pdfkit/api.py”, line 72, in from_string
return r.to_pdf(output_path)
File “env/lib/python3.6/site-packages/pdfkit/pdfkit.py”, line 159, in to_pdf
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-frappe’
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

Hi,

It may help to say the hosting environment and version of Frappe. What does wkhtmltopdf -V return?

it return 0.12.4

But i have also says the following code error

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 68, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 31, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 68, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1213, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/print_format.py”, line 95, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “apps/frappe/frappe/utils/pdf.py”, line 40, in get_pdf
filedata = pdfkit.from_string(html, False, options=options or {})
File “env/lib/python3.6/site-packages/pdfkit/api.py”, line 72, in from_string
return r.to_pdf(output_path)
File “env/lib/python3.6/site-packages/pdfkit/pdfkit.py”, line 159, in to_pdf
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-frappe’
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

any updates

You’re using unpatched version.

Download and install patched version: wkhtmltopdf

Done with many thanks…!