Skip to content

Getting Started Installing wkhtmltopdf

Francisco Quintero edited this page Oct 25, 2019 · 4 revisions

Linux Distros(mainly Debian/Ubuntu based)

  1. Remove any wkhtmltopdf installed using apt-get
sudo apt-get remove --purge wkhtmltopdf
  1. Install necessary dependencies
sudo apt-get install openssl build-essential xorg libssl-dev
  1. Download the static binary as per the architecture(i386/amd64)
wget  http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2
  1. Untar de compressed file
tar xvjf wkhtmltopdf-0.9.9-static-i386.tar.bz2
  1. Changer ownership of the executable
sudo chown root:root wkhtmltopdf-i386
  1. Move it the expected path to be usable system wide
sudo cp wkhtmltopdf-i386 /usr/bin/wkhtmltopdf

Windows 8 x64 Install

  1. Setup your wicked_pdf gem and run bundle install

  2. Download the executable http://code.google.com/p/wkhtmltopdf/downloads/detail?name=wkhtmltox-0.11.0_rc1-installer.exe

  3. Place it in your #SITE directory

  4. create an initilizer in config/initializers/wicked_pdf.rb with following code:

 WickedPdf.config = {
   :exe_path => '#SITE\wkhtmltopdf\wkhtmltopdf.exe'
 }
  1. Make sure that your server is running in a context that can write to that location with any pdf files otherwise, they will fail. Also don't miss the .exe part.