Try ERPNext Buy Support Partners Foundation

Error in Generating PDF (Print)

Dear community, I had below error during my attempt to generate PDF. Does anyone know the solution for this?

Version: v12.9.3 (version-12)

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 56, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 61, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1055, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/print_format.py", line 92, in download_pdf
    frappe.local.response.filecontent = get_pdf(html)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 38, in get_pdf
    filedata = pdfkit.from_string(html, False, options=options or {})
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pdfkit/api.py", line 72, in from_string
    return r.to_pdf(output_path)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pdfkit/pdfkit.py", line 156, in to_pdf
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: ProtocolUnknownError

which version of wkhtmltopdf, and on which OS?

Me too getting the same error

Using Ubuntu 18.04 and wkhtmlopdf 0.12.4/5/2 tried all .

Did you ever get this problem resolved?

I am having a similar issue with a brand new local installation. I hit the PDF button on a quote and I get the following error:

Blockquote
Traceback (most recent call last):
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/app.py”, line 64, in application
response = frappe.api.handle()
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/api.py”, line 58, in handle
return frappe.handler.handle()
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/handler.py”, line 30, in handle
data = execute_cmd(cmd)
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/handler.py”, line 70, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/init.py”, line 1113, in call
return fn(*args, **newargs)
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/utils/print_format.py”, line 92, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/elvisglazier/myfrappe/apps/frappe/frappe/utils/pdf.py”, line 40, in get_pdf
filedata = pdfkit.from_string(html, False, options=options or {})
File “/home/elvisglazier/myfrappe/env/lib/python3.8/site-packages/pdfkit/api.py”, line 72, in from_string
return r.to_pdf(output_path)
File “/home/elvisglazier/myfrappe/env/lib/python3.8/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 127. error:
/usr/local/bin/wkhtmltopdf: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

Blockquote

/usr/local/bin/wkhtmltopdf: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

Check to see if you have this library installed…on debian, the command would be
dpkg -l | grep libpng

That was the problem.

I solved the issue by installing the latest version of wkhtmltopdf

I was having another issue with my logo in the letterhead but strangely that ended up being solved by converting the logo fie from .jpg to .png

1 Like