11

I just downloaded version 10.0 for opensuse v. 11.3. I can convert a webpage (ie www.google.com) using it but cannot convert a local file. I grant all permissions on the file (& i've even tried running under sudo to no avail). This is the error:

"Loading pages (1/6) Error: Failed loading page file:///file.html".

The file exists but wkhtmltopdf refuses to load it. I even tried version 9.9 w/ the same result

What am I missing?

user_78361084
  • 3,538
  • 22
  • 85
  • 147
  • 1
    did you omit the full path on purpose? currently it looks like your file is placed in the root of the file system – Uku Loskit Dec 29 '10 at 00:44

3 Answers3

35

Just as a notice to any future people. I couldn't get the accepted answer working on Ubuntu 14.04, so I resorted to piping my HTML to the wkhtmltopdf command like so:

cat test.html | wkhtmltopdf - test.pdf

This is from the wkhtmltopdf command-line help:

Use - for stdin or stdout

jdeanwallace
  • 1,146
  • 9
  • 13
10

You need to provide the full path. Using file:/// does not make use of the current working directory. Rather, it specifies the path to the file from the root of the file system.

Pflugs
  • 772
  • 1
  • 10
  • 18
Uku Loskit
  • 40,868
  • 9
  • 92
  • 93
4

Try with this option :

wkhtmltopdf --enable-local-file-access

It works for me.

R1b0
  • 49
  • 3