我从Odoo website知道Odoo需要特殊的wkhtmltopdf版本:
危险
要打印PDF报告,您必须自己安装wkhtmltopdf:debian存储库中提供的wkhtmltopdf版本不支持页眉和页脚,因此无法自动安装。推荐的版本是0.12.1,可从wkhtmltopdf下载页面的“存档”部分获得。由于Debian Jessie没有正式发布,因此可以在我们每晚服务器的extra section上找到我们的官方版本。
因此,可以在Debian Jessie上安装该库,因为存在一个正式版本with qt patched
。
如果我将wkhtmltopdf用于Debian Stretch中的Debian Jessie,则该库无法正常工作。
如果我使用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。似乎尚不可用
我发现了这个wiki,Odoo开发人员说,建议将0.12.5-1
版本用于Odoo 10及更高版本
我已经在0.12.5-1
上阅读了此内容。作者似乎是Wkhtmltopdf的一名开发人员:
当前正在Git Hub Issue信息库中的返工包装系统上,您可以下载预览版本wkhtmltopdf/packaging。如果需要的话,将为0.12.1创建一些东西,希望在0.12.5发行之前解决odoo的任何问题。
以下解决方案有效:
从debian repo下载wkhtmltox_0.12.1.3-1~stretch_amd64.deb
和wkhtmltox_0.12.1.3-1~stretch_i386.deb
并安装
wkhtmltox_0.12.1.3-1~stretch_i386.deb
然后下载libssl并安装:
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
[当我尝试在Ubuntu中使用它时,它让我感到惊讶,我不得不下载源代码并进行编译,从github问题中检查此解决方案,有一种方法是通过编译wkhtmltopdf源代码,最终(如果未完成) )qt:
来源:wkhtmltopdf
[您可能必须手动编译最新版本的wkhtmltopdf和qt:
删除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
从git wkhtmltopdf和qt源克隆
https://github.com/OCA/account-financial-reporting/issues/33
编译qt
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
编译wkhtmltopdf
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y