When tapping on the pdf of an invoice, I am getting this error. erpnext v14

Server Error
Traceback (most recent call last):
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:
The switch --print-media-type, 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’
Exit with code 1 due to network error: ContentNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 95, 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 47, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1620, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/print_format.py”, line 134, in download_pdf
pdf_file = frappe.get_print(
File “apps/frappe/frappe/init.py”, line 2052, in get_print
return get_pdf(html, options=pdf_options, output=output)
File “apps/frappe/frappe/utils/pdf.py”, line 46, in get_pdf
frappe.throw(_(“PDF generation failed because of broken image links”))
File “apps/frappe/frappe/init.py”, line 540, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 508, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 454, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: PDF generation failed because of broken image links

Is it a custom print format? If yes, try remove the image in the code. If without image if PDF is working then it is from image source… If you share your code, then it will be easy to give solution

This might be due to two issues:

  1. The image link which you have used is having some error.
  2. <img src"/files/image.png"> You might have used this tag to print the image in the print format. The link in the src might be from your local storage or any web link. Try to download the image and upload it in the file doctype. In the file doctype once you upload the image, you will see the “File URL” field. Copy the value in that field and paste in that img src tag in html.

Reference of the file url:

even the standard print is not able to take the pdf

for standard print without image is also having the same issue

I have the same problem. And my reports dont have any images… :frowning: