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

半世苍凉 提交于 2019-12-04 05:01:18

问题


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


回答1:


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.

  • wkhtmltox_0.12.1.3-1~stretch_amd64.deb
  • wkhtmltox_0.12.1.3-1~stretch_i386.deb



回答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



回答3:


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


来源:https://stackoverflow.com/questions/48245026/how-to-make-wkhtmltopdf-work-in-odoo-v10-on-debian-9-stretch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!