如何使 wkhtmltopdf 在 Debian 9 "Stretch" 上的 Odoo v10 中工作?
How to make wkhtmltopdf work in Odoo v10 on Debian 9 "Stretch"?
我从 Odoo website 知道 Odoo 需要一个特殊的 wkhtmltopdf 版本:
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.
因此,可以在 Debian Jessie 上安装库,因为有一个非官方版本 with qt patched
.
如果我在 Debian Stretch 中使用 Debian Jessie 的 wkhtmltopdf,该库无法运行。
如果我使用 sudo apt-get install wkhtmltopdf
安装 wkhtmltopdf,当我尝试打印任何报告时会收到此警告:
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
有没有其他方法可以在 Debian Stretch 中为 Odoo 安装 wkhtmltopdf?
Odoo 10 和 Debian Stretch 是否有任何其他可用版本?
更新
我找到了this Git Hub issue。好像还没有
当我尝试在 Ubuntu 中使用它时,我遇到了这个问题,我不得不下载源代码并编译它,从 github 问题中检查这个解决方案,有一个解决方案通过编译 wkhtmltopdf 源代码并最终(如果没有)qt :
来源:
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:
删除 wkhtmltopdf 和相关包
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
安装编译需求包
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
从 git wkhtmltopdf 和 qt 源代码克隆
$ 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 .
编译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
编译wkhtmltopdf
$ cd ../wkhtmltopdf
$ sudo ../qt-wkhtmltopdf/bin/qmake
$ sudo make -j3
$ sudo make install Reboot
$ sudo reboot
以下解决方案有效:
从 debian 仓库下载 libssl and libpng 并安装
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
然后下载 wkhtmltopdf 并安装:
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
然后添加符号链接:
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
更新 (2019/02/28)
我发现此 wiki where Odoo Developers say the version 0.12.5-1
推荐用于 Odoo 10 及更高版本
我在 Git Hub Issue 上读过这篇文章。作者似乎是 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.
我从 Odoo website 知道 Odoo 需要一个特殊的 wkhtmltopdf 版本:
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.
因此,可以在 Debian Jessie 上安装库,因为有一个非官方版本 with qt patched
.
如果我在 Debian Stretch 中使用 Debian Jessie 的 wkhtmltopdf,该库无法运行。
如果我使用
sudo apt-get install wkhtmltopdf
安装 wkhtmltopdf,当我尝试打印任何报告时会收到此警告: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
有没有其他方法可以在 Debian Stretch 中为 Odoo 安装 wkhtmltopdf?
Odoo 10 和 Debian Stretch 是否有任何其他可用版本?
更新
我找到了this Git Hub issue。好像还没有
当我尝试在 Ubuntu 中使用它时,我遇到了这个问题,我不得不下载源代码并编译它,从 github 问题中检查这个解决方案,有一个解决方案通过编译 wkhtmltopdf 源代码并最终(如果没有)qt :
来源: 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:
删除 wkhtmltopdf 和相关包
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
安装编译需求包
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
从 git wkhtmltopdf 和 qt 源代码克隆
$ 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 .
编译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
编译wkhtmltopdf
$ cd ../wkhtmltopdf
$ sudo ../qt-wkhtmltopdf/bin/qmake
$ sudo make -j3
$ sudo make install Reboot
$ sudo reboot
以下解决方案有效:
从 debian 仓库下载 libssl and libpng 并安装
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
然后下载 wkhtmltopdf 并安装:
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
然后添加符号链接:
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
更新 (2019/02/28)
我发现此 wiki where Odoo Developers say the version 0.12.5-1
推荐用于 Odoo 10 及更高版本
我在 Git Hub Issue 上读过这篇文章。作者似乎是 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.