Error in pdf generation

Hello,
When I try to generate pdf the following error occurs-

Traceback (most recent call last):
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/utils/print_format.py”, line 92, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 38, in get_pdf
filedata = pdfkit.from_string(html, False, options=options or {})
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/site-packages/pdfkit/api.py”, line 72, in from_string
return r.to_pdf(output_path)
File “/opt/bitnami/apps/erpnext/htdocs/frappe-bench/env/lib/python3.7/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 -6. 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.QXcbConnection: Could not connect to display

Any suggestion are welcomed.

It may help to say which version of ERPNext, how installed and the operating environment.

Is this happening the first time an attempt is being made to generate a pdf?

Can you post the output of : wkhtmltopdf -V

1 Like