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://
?
Open a command prompt window. The syntax for using the tool is fairly simple, enter the name wkhtmltopdf, followed by the URL of the web page, and the name of the PDF that you want to create, like so.
Wkhtmltopdf is an open source simple and much effective command-line shell utility that enables user to convert any given HTML (Web Page) to PDF document or an image (jpg, png, etc).
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With