How to Install wkhtmltopdf on Ubuntu Server 14.04

I wanted to use wkhtmltopdf on an Ubuntu 14,04 webserver. Up to now I have been always working with the binaries directly. However, after I downloaded the binaries from these came up with the following error:

./wkhtmltox-i386.deb: line 1: syntax error near unexpected token `newline'
./wkhtmltox-i386.deb: line 1: `!'

As I did not have much more time to lose, I followed the tutorial here (which dated almost 2 years ago, and was for Ubuntu 12.04). After some minor adjustments, was able to produce the desired result. Here is the code snippet:

apt-get install wkhtmltopdf
apt-get install xvfb
echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' > /usr/bin/
chmod a+rx /usr/bin/
ln -s /usr/bin/ /usr/local/bin/wkhtmltopdf
/usr/bin/ output.pdf

Awesome job Ashish Kulkarni, and Jakob Truelsen for developing this awesome piece of software wkhtmltopdf, and Fedir Rykhtik for compiling the script above.


Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form. Links to this article are welcome

Other Related Articles