Install wkhtmltopdf on Ubuntu

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!


Үнэлсэн: 0 удаа.
Sunday, June 7, 2015,12:18 AM | Category: Sysadmin
send |

post comment
comments (0) | :