Wkhtmltopdf failing

I have this error when trying to print out a pdf in a new instance I just created yest

Traceback (innermost last):
      File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 52, in application
        response = frappe.api.handle()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 42, in handle
        return frappe.handler.handle()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 66, in handle
      File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 89, in execute_cmd
        ret = frappe.call(method, **frappe.form_dict)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 531, in call
        return fn(*args, **newargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/templates/pages/print.py", line 94, in download_pdf
        frappe.local.response.filecontent = get_pdf(html)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 28, in get_pdf
        pdfkit.from_string(html, fname, options=options or {})
      File "/home/frappe/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/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py", line 131, in to_pdf
        ' '.join(args))
     IOError: Command failed: /usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/f73bb79af6ca7dcd93919a11de5303be588ee061ec9d56bc5c0d22fd.pdf
    Check whhtmltopdf output without 'quiet' option

Hey. Can you check the output of:
which wkhtmltopdf
from command line?

It should be /usr/bin/wkhtmltopdf


Hi @anand ,

The response to “which wkhtmltopdf” is the same


What is the output of

wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm https://en.wikipedia.org /tmp/f73bb79af6ca7dcd93919a11de5303be588ee061ec9d56bc5c0d22fd.pdf


Loading pages (1/6)
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Printing pages (6/6)


This vindicates wkhtmltopdf and you seem to have permissions to /tmp

Does this happen for all documents?

Yes, it does happen for all documents

Whats the installation method used for wkhtmltopdf?

I think its something to do with the version . What is the version required ?

I don’t think wkhtmltopdf is at fault here. You can try the latest version from wkhtmltopdf


I got it. I was having the reduced fuctionality wkhtmltopdf installed.