wkhtmltopdf command fails

phidah picture phidah · Apr 25, 2011 · Viewed 20k times · Source

I am trying to convert a HTML file to PDF using wkhtmltopdf.

For that purpose I have installed wkhtmltopdf on a Debian box and am trying to run this command:

/usr/bin/xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf /path/convert.1303714349.4961.html.tmp /path/convert.1303714349.4961.pdf.tmp

I get the following error:

Loading page (1/2)
Error: Failed loading page file:///path/convert.1303714349.4961.html.tmp (sometimes it will work just to ignore this error with --ignore-load-errors)

The file does exist in /path/convert.1303714349.4961.html.tmp, and the permissions are set correctly. Can it have anything to do with the path being prepended with file://?

Answer

Daniel Andersson picture Daniel Andersson · Jul 2, 2011

I believe wkhtmtopdf does not handle local files with non-typical extensions. Try renaming the input file to *.html.

See issue and comments at https://web.archive.org/web/20131124022426/http://code.google.com/p/wkhtmltopdf/issues/detail?id=486.