wkhtmltopdf command fails

23,368

Solution 1

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.

Solution 2

Another useful tip is to replace the spaces in the filename by some char like "_", because of when the filename has spaces the process fails loading page

Share:
23,368
phidah
Author by

phidah

Updated on December 22, 2020

Comments

  • phidah
    phidah over 3 years

    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://?

  • Natus Drew
    Natus Drew almost 9 years
    Where do I set --load-error-handling ignore? In the Rails config initializer?