I had some minor problems getting wkhtmltopdf running that might stump some people, so here are my instructions on getting it running on Ubuntu 10.04. These instructions perhaps should be added to INSTRUCTIONS.txt

1. Download wkhtmltopdf. http://code.google.com/p/wkhtmltopdf/downloads/list
2. Extract it and move it to /usr/bin/
3. Rename it to wkhtmltopdf so that now you have an executable at /usr/bin/wkhtmltopdf
4. Set permissions: sudo chmod a+x /usr/bin/wkhtmltopdf
4. Install required support packages. sudo apt-get install openssl build-essential xorg libssl-dev
5. Check to see if it works: run wkhtmltopdf http://www.google.com test.pdf. If it works, then you are done -- make sure to make a symbolic link as per INSTRUCTIONS.txt. If you get the error "Cannot connect to X server" then continue to number 6.
6. We need to run it headless on a 'virtual' x server. We will do this with a package called xvfb. sudo apt-get install xvfb
7. We need to write a little shell script to wrap wkhtmltopdf in xvfb. Make a file called wkhtmltopdf.sh and add the following:
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf $*
8. Move this shell script to /usr/bin, and set permissions: sudo chmod a+x /usr/bin/wkhtmltopdf.sh
9. Finally, make your symbolic link in /sites/all/modules/print/lib. Command is ln -s /usr/bin/wkhtmltopdf.sh wkhtmltopdf


phayes’s picture

Oh! And you must add "--quiet" to your wkhtmltopdf options else your PDFs will be corrupted with shell output.

jcnventura’s picture

Status: Needs review » Postponed (maintainer needs more info)

Which version of the module are you running?

The latest dev doesn't require any of the steps 6-9. Steps 2 and 3 are unnecessary and confusing (as they go against INSTALL.txt). Steps 4 and 4 are only needed if the user is not familiar with Linux, which I am assuming they are. Step 1 is already in the INSTALL.txt.

The only useful step is indeed 5. I will add that to the INSTALL.txt file.

ppcc’s picture

The part of step 3 that states renaming the file is useful too, as the extracted file name is something like wkhtmltopdf-amd64, which this module doesn't recognise.

phayes’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Indeed, it does seems to be working without that shell script mediating the process. My apologies for confusing things.

didymo’s picture


You seam to be running ubuntu, as do I.

I installed wkhtmltopdf, xvfb from apt and then simlinked to teh executatles from the /modules/print/lib/ directory.

however I get "wkhtmltopdf: cannot connect to X server" , so what did you do that is nhot in the instructions?

If you do not mind me asking.



SocialNicheGuru’s picture

Category: task » support
Status: Closed (fixed) » Active

This seems like the best place for this question.

I downloaded the file and unzipped it.
Now what?
I have libraries module enabled and site/libraries in place.
Which of these is the executable that I should place in the libraries directory? Isn't *.dll a windows version?
And what do I name the directory as the package unzips into lib, include, and exaples directories.

unzip l*zip
Archive: libwkhtmltox-0.10.0_beta5_2.zip
creating: lib/
inflating: lib/libwkhtmltox0.a
inflating: lib/wkhtmltox0.dll
creating: include/
creating: include/wkhtmltox/
inflating: include/wkhtmltox/pdfsettings.hh
inflating: include/wkhtmltox/settings.hh
inflating: include/wkhtmltox/dllbegin.inc
inflating: include/wkhtmltox/dllend.inc
inflating: include/wkhtmltox/websettings.hh
inflating: include/wkhtmltox/multipageloader.hh
inflating: include/wkhtmltox/converter.hh
inflating: include/wkhtmltox/utilities.hh
inflating: include/wkhtmltox/pdf.h
inflating: include/wkhtmltox/loadsettings.hh
inflating: include/wkhtmltox/pdfconverter.hh
inflating: include/wkhtmltox/image.h
inflating: include/wkhtmltox/imageconverter.hh
inflating: include/wkhtmltox/imagesettings.hh
inflating: examples/Makefile
inflating: examples/pdf_c_api.c

jleinenbach’s picture

What's your OS as you downloaded the Windows version:

libwkhtmltox-0.10.0_beta5_2.zip libwkhtmltox-0.10.0_beta5 Windows Static Library (i368)

2ndmile’s picture

Why not just download the "wkhtmltopdf-0.10.0_beta5 Linux Static Binary (amd64)" or "wkhtmltopdf-0.10.0_beta5 Linux Static Binary (i368)"? Un-archive and upload into the libraries folder. Done and done.

jcnventura’s picture

Status: Active » Closed (fixed)

Please don't re-open closed issues.

Anyway, this really isn't the best place to ask that. Please ask that question to the wkhtmltopdf developers, there should be an issue queue for that where you downloaded it.


jason.fisher’s picture