PDF support in Ubuntu with wkhtmltopdf

The following script will download a version of wkhtmltopdf that is known to work well with Ubuntu 12 and Ubuntu 14 (LTS x64 versions). It installs it, puts it in the right place and installs the required dependencies (updated with new location for wkhtmltopdf binaries).

#!/bin/bash

# this script downloads and installs the correct version of wkhtmltopdf
# you need to be root. 

if (( $EUID != 0 )); then
    echo "Please run as root"
    exit
fi

#get the pdf software (dont show anything on the screen)
wget download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb >/dev/null 2>&1

apt-get install -y php5-curl curl libxrender1 libfontconfig1 xorg libssl-dev fontconfig libjpeg8 xfonts-75dpi libjpeg-turbo8

dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

echo "Installation complete!"

rm wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

 

Leave a Reply

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