Convert html to pdf using wkhtmltopdf

wkhtmltopdf is a Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.
Requirements:
To compile this project requires:
* QT 4.4 or above
* CMake 1.6 or above
* Subvertion (For SVN builds)

Compiling:
To compile and install the source from svn issue the following commands:

svn checkout http://wkhtmltopdf.googlecode.com/svn/trunk/ wkhtmltopdf
cd wkhtmltopdf
cmake -D CMAKE_INSTALL_PREFIX=/usr .
make
sudo make install

Note this only works on none Windows platforms. As the code is written using QT and CMake it should be easy to compile on Windows, but as I do not own a copy of the said OS, I cannot tell you how.

Usage:
To convert a remote HTML file to PDF:
# wkhtmltopdf http://www.google.com google.pdf
To convert a local HTML file to PDF:
#wkhtmltopdf my.html my.pdf
You can also convert to PS files if you like:
#wkhtmltopdf my.html my.ps

reference,
wkhtmltopdf Home Page
wkhtmltopdf SVN
http://www.daimi.au.dk/~jakobt/#wkhtmltopdf

Leave a Reply