Skip to content

Instantly share code, notes, and snippets.

@ermand
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ermand/67a4ce7cf01f380c7e84 to your computer and use it in GitHub Desktop.
Save ermand/67a4ce7cf01f380c7e84 to your computer and use it in GitHub Desktop.
Installing wkhtmltopdf on Ubuntu Server 12.04
### Install guide
sudo apt-get update
sudo apt-get install wkhtmltopdf
sudo apt-get install xvfb
echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' > /usr/bin/wkhtmltopdf.sh
chmod a+x /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com output.pdf
########################################################
### In case not all the features are working try the second guide
#1. Remove wkhtmltopdf installed using apt-get previously (if previously installed).
sudo apt-get remove --purge wkhtmltopdf
#2. Install dependencies.
sudo apt-get install openssl build-essential xorg libssl-dev
#3. Download the static binary as per the architecture (i386/amd64). Extract it, change the owner and then copy it to /usr/local/bin.
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
sudo chown root:root wkhtmltopdf-amd64
sudo cp wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment