Print reports by wkhtmltopdf

Why do in need wkhtmltopdf package?

In odoo, whenever you create a report, it created as html format page. After that, if you need to download it on pdf format, you need to have wkhtmltopdf package to to this conversion.


How to make sure if it is installed or not?

To check if you have wkhtmltopdf installed or not you need to login as system administrator and open the settings.

  1. Open system settings tab
  2. Find the Companies section
  3. under Document Layout, click on Preview Document
    1. If it prints a sample page, it means you had done the required setup before. 
    2. If you have received an alert popup which it says something like: "You need to install Wkhtmltopdf",  it means that you need to follow the installation instruction.

Installation of WKHTMLTOPDF


apt-get install wkhtmltopdf

In linux debian or ubunu you can use this command to install the package. It is ease to deploy.

You can find more information about it in pypi.org website on link below:


            

Using the dpkg command:

In case you are using persian language, the only package witch is working properly is this method of installation.
1- Download the latest version of wkhtmltopdf package based on your os platform.
    1. Open the website: https://wkhtmltopdf.org/downloads.html
    2. Find out which package is the best.
    3. Copy link address
    4. Download it: 
wget -i https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb
2- Install the package.
dpkg -i wkhtmltox_0.12.6.1-2.bullseye_amd64.deb

Note: In case you get some errors about libssl missing, you need to install it first: wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb 

After that you need to fix the failed installation:

sudo apt install -f
3- Copy installation files:
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
4- Restart your odoo service.
systemctl restart odoo
Views
1 Total Views
1 Members Views
0 Public Views
Actions
0 Likes
0 Dislikes
0 Comments
Share on Social Networks
Share Link
Share by mail

Please login to share this webpage by email.