How to Install wkhtmltopdf?

14,121

Solution 1

Installing wkhtmltopdf

on Ubuntu Linux machine

  1. First check os is 32 bit or 64 bit by using following command

    Try uname -m. It seems like the uname -m actually gives x86_64 when it is an kernel 64 bits

  2. Run following command

    sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
    
  3. Then run following command

    sudo apt-get install wkhtmltopdf
    
  4. Based on OS download wkhtmltopdf package from following site

    http://code.google.com/p/wkhtmltopdf/downloads/list

    OR

    wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2
    

    (wkhtmltopdf-0.9.9-static-i386.tar.bz2 is a stable release for wkhtmltopdf )

  5. Then extract using command

    tar xvjf wkhtmltopdf-0.9.9-static-i386.tar.bz2
    
  6. Then move extracted DIR to usr/local/bin folder

    sudo mv wkhtmltopdf-i386 /usr/local/bin/wkhtmltopdf
    
  7. Check wkhtmltopdf is install or not using following command

    which wkhtmltopdf
    wkhtmltopdf –help
    

Installing wkhtmltopdf on MacOs

brew install Caskroom/cask/wkhtmltopdf

Solution 2

Another way to use official binaries within Rails is adding the following line to your Gemfile:

gem 'wkhtmltopdf-installer'

This way the official binaries from http://wkhtmltopdf.org will be downloaded and added to your bundle during bundle install phase.

Share:
14,121
chandrashekar
Author by

chandrashekar

Hi....

Updated on June 04, 2022

Comments

  • chandrashekar
    chandrashekar about 2 years

    Now i am working on rails 3.0.0.i am using Ubuntu 11.10 ,64 bit os.i want to install wkhtmltopdf.please tell me the static version of wkhtmltopdf.