How to make wkhtmltopdf work in Odoo v10 on Debian 9 "Stretch"?
Asked Answered
W

3

3

I know from the Odoo website that Odoo needs an special wkhtmltopdf version:

Danger

to print PDF reports, you must install wkhtmltopdf yourself: the version of wkhtmltopdf available in debian repositories does not support headers and footers so it can not be installed automatically. The recommended version is 0.12.1 and is available on the wkhtmltopdf download page, in the archive section. As there is no official release for Debian Jessie, you can find ours on the extra section of our nightly server.

So, it is possible to install the library on Debian Jessie because there is an extraofficial version with qt patched.

  • If I use the wkhtmltopdf for Debian Jessie in Debian Stretch, the library is not working.

  • If I install wkhtmltopdf using sudo apt-get install wkhtmltopdf I get this warning when I try to print any report:

    Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.No protocol specified
    QXcbConnection: Could not connect to display
    

Is there any other way to install wkhtmltopdf for Odoo in Debian Stretch?

Is there any other available version for Odoo 10 and Debian Stretch?

Update

I have found this Git Hub issue. It seems it is not available yet

Watercourse answered 13/1, 2018 at 22:50 Comment(2)
Have you tested to compile the library from the source ?Steal
this helped me https://mcmap.net/q/501468/-how-to-make-wkhtmltopdf-work-in-odoo-v10-on-debian-9-quot-stretch-quotActinal
W
3

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.

Watercourse answered 3/5, 2018 at 11:1 Comment(0)
P
2

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
Proteolysis answered 16/4, 2018 at 13:59 Comment(1)
From my experience, wkhtmltopdf works fine but i found some encoding issues with printing large pdf files with many printers (but displaying was cool). Then I tried to find an other way creating a nodejs microservice with pupeeter and everything has worded fine. Hoping that can help.Proteolysis
S
0

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
Steal answered 14/1, 2018 at 0:46 Comment(1)
Thank you for answering. I made a mistake, my question was for the last Debian version "Stretch". I found this issue which explains that is not available yetWatercourse

© 2022 - 2024 — McMap. All rights reserved.