I installed wkhtmltopdf using apt and it put the executable in /usr/bin. However, the print module failed to recognize that it was installed. It kept telling me that no PDF tool was installed. I created a symbolic link in /sites/all/modules/print/lib to /usr/bin/wkhtmltopdf. The module maintainer said that this step is no longer necessary, but I went ahead and tried it anyways. And voila! After I created this symbolic link, the module immediately recognized the wkhtmltopdf library!

However, whenever I try to generate a PDF using the Print module, I get a bogus 2-3kb PDF that is un-openable by Adobe Reader.

I tried wkhtmltopdf via the command line and got an error stating that it couldn't connect to the X server or something like that. I found instructions here on how to fix that: #870058: Better wkhtmltopdf instructions

After following those steps, I was able to successfully generate a good PDF via the command line. Unfortunately, following those steps didn't resolve the problem with the Print module. It is still generating un-readable PDFs.

The only thing I see in the log is this:
wkhtmltopdf ["/usr/bin/wkhtmltopdf.sh" --page-size A4 --orientation portrait --dpi 96 --disable-local-file-access --footer-font-size 7 --footer-right '[page]' - -] (returned 1): No stderr output available.

I'm using Debian Squeeze/Debian Linux 6.0.
apt installed wkhtmltopdf 0.9.9

Comments

jonhy81’s picture

+ 1

trigdog’s picture

I was also having this same issue. I removed the default wkhtmltopdf options at admin/config/user-interface/print/pdf/wkhtmltopdf from:

--footer-font-size 7 --footer-right '[page]'

and just added this:

--quiet

This fixed the error for me. I am using the most recent version of wkhtmltopdf (0.12.2.1).

ferriol’s picture

I having this issue too, I'm using Debian Whezzy 7.8.

I installed wkhtmltopdf with apt-get

#2 solution doesn't work for me

I still have:
wkhtmltopdf ["/usr/bin/wkhtmltopdf" --page-size A4 --orientation portrait --dpi 96 --disallow-local-file-access --quiet - -] (returned 1): No stderr output available.

I execute in command line

/usr/bin/wkhtmltopdf --page-size A4 --orientation portrait --dpi 96 --disallow-local-file-access --quiet http://drupal.org drupal.pdf
wkhtmltopdf: cannot connect to X server
xvfb-run /usr/bin/wkhtmltopdf --page-size A4 --orientation portrait --dpi 96 --disallow-local-file-access --quiet http://drupal.org drupal.pdf

Works !!

I have in print/lib

print/lib$ ls -l
.....
lrwxrwxrwx 1 www-data www-data      20 oct  2 11:26 wkhtmltopdf -> /usr/bin/wkhtmltopdf
lrwxrwxrwx 1 www-data www-data      13 oct  2 11:26 Xvfb -> /usr/bin/Xvfb
lrwxrwxrwx 1 www-data www-data      17 oct  2 11:26 xvfb-run -> /usr/bin/xvfb-run

I don't know what I have to do.

It seems missing command xvfb-run

[UPDATE] I created the wkhtmltopdf.sh, mentioned here in print/lib directory and I created a symbolic link
ln -s wkhtmltopdf.sh wkhtmltopdf

And my pdf generation works !