wkhtmltopdf install on Centos 6

htlp to pdf

from Google code site – what is wkhtmltopdf :

Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

All the tutorials I found on the net are how to install it via aptitude, 
but I needed to install from source a specific older version , so this is what i did:


install all the needed packages  – these are going to be a big bunch:

yum -y install openssl xorg-x11-server-Xorg openssl-devel qt qt-devel gcc-c++ qtwebkit qtwebkit-devel xorg-x11-server-Xvfb 

Get the code

you can download the source code from https://code.google.com/p/wkhtmltopdf/
I need the 0.9.9 version so I took that one

cd /root
wget "https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9.tar.bz2"
bunzip2 wkhtmltopdf-0.9.9.tar.bz2
tar xvf wkhtmltopdf-0.9.9.tar
cd wkhtmltopdf-0.9.9


fix error in code 

there was a problem to compile the code due to a link to a non existing module:

cp wkhtmltopdf.pro wkhtmltopdf.pro_bak
vim wkhtmltopdf.pro 
change line 19 from:
PRL  = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl
PRL  = $$[QT_INSTALL_LIBS] libQtGui.prl
save and exit 

compile !

make install

test !

we need to run the wkhtmltopdf in a virtual screen so the test line would look like:

xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf http://www.google.com google.pdf

Technorati Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>