PDF generate issue debian 11 - ERP Next 14

Hi,

I got the issues system can not generate PDF, I dropped my issues detail below, please help me fix it.

File “apps/frappe/frappe/init.py”, line 493, in msgprint
_raise_exception()
title = None
as_table = False
as_list = False
indicator = ‘red’
alert = False
primary_action = None
is_minimizable = False
wide = False
sys = <module ‘sys’ (built-in)>
out = {‘message’: ‘PDF generation failed because of broken image links’, ‘title’: ‘Message’, ‘indicator’: ‘red’, ‘raise_exception’: 1}
_raise_exception = <function msgprint.._raise_exception at 0x7f5cf6320a60>
_strip_html_tags = <functools._lru_cache_wrapper object at 0x7f5cf635e980>
inspect = <module ‘inspect’ from ‘/usr/local/lib/python3.10/inspect.py’>
msg = ‘PDF generation failed because of broken image links’
raise_exception = <class ‘frappe.exceptions.ValidationError’>
strip_html_tags = <function strip_html_tags at 0x7f5cfb06a320>
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
inspect = <module ‘inspect’ from ‘/usr/local/lib/python3.10/inspect.py’>
msg = ‘PDF generation failed because of broken image links’
raise_exception = <class ‘frappe.exceptions.ValidationError’>
frappe.exceptions.ValidationError: PDF generation failed because of broken image links

which version of wkhtmltopdf do you have? (recommended is 0.12.6+ qt patched)

Hi @trentmu , I got issue when I check version

wkhtmltopdf --version
wkhtmltopdf: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

does indicate that there is a missing library…try this
sudo apt install -y libjpeg-tools

and then retry the wkhtmltopdf --version command

I installed the last version, but got a new “time out issue”

image

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 83, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1590, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/print_format.py”, line 129, in download_pdf
pdf_file = frappe.get_print(
File “apps/frappe/frappe/init.py”, line 2023, in get_print
return get_pdf(html, options=pdf_options, output=output)
File “apps/frappe/frappe/utils/pdf.py”, line 38, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
File “env/lib/python3.10/site-packages/pdfkit/api.py”, line 75, in from_string
return r.to_pdf(output_path)
File “env/lib/python3.10/site-packages/pdfkit/pdfkit.py”, line 201, in to_pdf
self.handle_error(exit_code, stderr)
File “env/lib/python3.10/site-packages/pdfkit/pdfkit.py”, line 155, in handle_error
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: TimeoutError

from this post…Wkhtmltopdf layout error - #4 by lasalesi maybe check for

  • the hostname configuration of ERPNext (see site/site1.local/site_config.json should contain "host_name": "https://www.yourdomain.com",)
  • by a missing libssl1.0-dev