How to make wkhtmltopdf work in Odoo v10 on Debian 9 “Stretch”?

孤街浪徒 提交于 2019-12-02 04:16:35

Update (2019/02/28)

I found this wiki where Odoo Developers say the version 0.12.5-1 is recommended for Odoo 10 and later


I have read this on a Git Hub Issue. The writer seems one developer of Wkhtmltopdf:

Currently working on a reworked packaging system in the wkhtmltopdf/packaging repository, you can download preview builds for linux. Will create something for 0.12.1 if required, would appreciate fixing any issues with odoo before the 0.12.5 release.

DjimOnDev

The solution below worked:

Download libssl and libpng from debian repo and install

wget http://ftp.fr.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1+deb7u2_amd64.deb
wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb

dpkg -i libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb
dpkg -i libpng12-0_1.2.49-1+deb7u2_amd64.deb

Then download wkhtmltopdf and install :

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb17
dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb

Then add symlink:

sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin

It It hapened to me when I tried to use it in Ubuntu, I had to download the source and compile it, check this solution from a github issue, there is a solution by compiling the wkhtmltopdf source and eventually (if it's not doen) qt :

Source : https://github.com/OCA/account-financial-reporting/issues/33

It's likely that you'll have to manually compile the latest version of wkhtmltopdf and qt:

Remove wkhtmltopdf and related package

 $ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf

 $ sudo apt-get autoremove 

Install requirement package for compiling

 $  sudo apt-get install openssl build-essential libssl-dev libxrender-dev  git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y 

Clone from git wkhtmltopdf and qt source

 $ git clone git://github.com/wkhtmltopdf/wkhtmltopdf.git wkhtmltopdf
 $ mkdir qt-wkhtmltopdf && cd qt-wkhtmltopdf
 $ git clone https://www.github.com/wkhtmltopdf/qt --depth 1 --branch wk_4.8.7 --single-branch . 

Compile qt

$ sudo ./configure -nomake tools,examples,demos,docs,translations -opensource -prefix "`pwd`" `cat ../wkhtmltopdf/static_qt_conf_base ../wkhtmltopdf/static_qt_conf_linux | sed -re '/^#/ d' | tr '\n' ' '`
$ sudo make -j3 
$ sudo make install

Compile wkhtmltopdf

$ cd ../wkhtmltopdf
$ sudo ../qt-wkhtmltopdf/bin/qmake
$ sudo make -j3
$ sudo make install Reboot 
$ sudo reboot
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!