Can't see print document as PDF - IOError: wkhtmltopdf reported an error network error: HostNotFoundError

Hi there.

I’m facing the follow issue when I click to view the print document as PDF:

Traceback (most recent call last):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/api.py", line 53, in handle
    return frappe.handler.handle()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 939, in call
    return fn(*args, **newargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/print_format.py", line 48, in download_pdf
    frappe.local.response.filecontent = get_pdf(html)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 18, in get_pdf
    pdfkit.from_string(html, fname, options=options or {})
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py", line 68, in from_string
    return r.to_pdf(output_path)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py", line 116, in to_pdf
    raise IOError('wkhtmltopdf reported an error:\n' + stderr.decode('utf-8'))
IOError: wkhtmltopdf reported an error:
Error: Failed loading page http://15mm (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: HostNotFoundError

Try a search like this for help pointers? ‘IOError: wkhtmltopdf reported an error’

I think you need to ensure that the hostname is in the config file.

Sorry for so few details but not near my pc

Tried too, not worked

Try setting “host_name”: “local host” in your site_config.json