Install wkhtmltopdf on Ubuntu

Hi guys,

In this tutorial I will learn you how to install Wkhtmltopdf on Ubuntu. You will need Wkhtmltopdf to print out PDF reports in your Odoo or you will get a warning message saying that you don’t have Wkhtmltopdf.
There are two ways to install Wkhtmltopdf. Method #1 is through an executable file and method #2 is by command. If you do not care about technical details and how it works simply read on. Want to know the technical details and learn how to do it yourself? Then start reading from chapter 2.

1. Install Wkhtmltopdf through executable script

Open up your Ubuntu terminal and create a new .sh file

Now add the following code in it:

The next step is to make the file executable

And finally, now it is executable, execute it.

After the script is done you will see something along these lines:
Installed wkhtmltopdf on Ubuntu
After restarting your Odoo/Ubuntu you will be able to use Wkhtmltopdf and print PDF files.

2. Install Wkhtmltopdf manually from the terminal

So you don’t want to install it automatically but learn more about this? Lets start!
The first thing you need to do is download the Wkhtmltopdf files from the website. wget -P will download these files.

This is telling Ubuntu to download the files from the website with sudo (administrator) rights and to place them in the Downloads folder.
Now that you have the files in your Downloads folder you should navigate to them

The next step is to install it by dpkg. Dpkg is the package installer from Ubuntu and will be responsible for installing/removing files.
So lets install the package.

Now that it is installed you still need to move the wkhtmltopdf and wkhtmltoimage files under /usr/bin/ to make Wkhtmltopdf work with Ubuntu and accessible for the user. First navigate to the correct folder

Now copy the files from your Downloads folder to your bin so that they can be used by your Odoo.

When you now reload your Odoo or restart the server you can use Wkhtmltopdf and PDF’s will be generated automatically!




Odoo Experts

10 thoughts on “Install wkhtmltopdf on Ubuntu

  1. Akram says:

    Hi,

    I am trying to install wkhtmltopdf on Ubuntu 15.04 and followed your approach to install the same.

    But the report prints without formatting the cell, table, etc. Content is aligned left side of the page without formatting.

    (The same happened when I installed it on Ubuntu 14.04 for which I then decided to go with Ubuntu 15.04.)

    Any suggestions.

    Thanks
    Akram

    • Yenthe666 says:

      Hi Akram,

      Sounds like you either don’t have Wkhtmltopdf installed or that your Odoo can’t find it. Have a double check if the Wkhtmltopdf is actually on your system first. If you don’t get things working just take my script again and re-run it.

      Yenthe

  2. I have everything installed and working fine on the command line.

    Odoo gives me Error in Wkhtmltopdf error code 11.

    Do you have any idea on how I might solve this?

  3. Andre says:

    Hi Yenthe,

    I did try everything according to the manual, but still not working. My config is as follows Server A has the front end and Server B has the back-end installed. Both servers are on ubuntu 14.04.3 LTS. On which server has the Wktohtml be installed. I am running postgres in a cluster based on bdr

    Please advise

    • Yenthe666 says:

      Hi Andre,

      The Wkhtmltopdf should be installed on the B server, which has the back-end and the core of Odoo. If this still doesn’t work I’m going to guess you have some issues with the separation of your back-end and front-end, which makes Odoo unable to find or use Wkhtmltopdf

  4. hello i have problem i m install this.

    package architecture (amd64) does not match system (i386)

    where i can download for i386 deb

    Thank for sharing

  5. Alifah says:

    Hi Mr. Yenthevg.
    Thank you so much for made this tutorial.
    I’ve been searching so long for wkhtmltopdf installation and now I found it.
    This tutorial help me so much. 🙂

Leave a Reply

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