Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – 如何在debian 64位上正确安装wkhtmltopdf?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在尝试安装wkhtmltopdf,但是当我这样做时: sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb 我明白了: Preparing to unpack wkhtmltox-0.12.1_linux-trusty-amd64.deb ... Unpacking wkhtmltox (0.12.1) over (0.12.1) ... d
我正在尝试安装wkhtmltopdf,但是当我这样做时:
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

我明白了:

Preparing to unpack wkhtmltox-0.12.1_linux-trusty-amd64.deb ...
Unpacking wkhtmltox (0.12.1) over (0.12.1) ...
dpkg: dependency problems prevent configuration of wkhtmltox:
  wkhtmltox depends on libjpeg-turbo8; however:
  Package libjpeg-turbo8 is not installed.

dpkg: error processing package wkhtmltox (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
 wkhtmltox

所以我试过了

apt-get update
apt-get install libjpeg-turbo8

然后我明白了

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libjpeg-turbo8 is not available,but is referred to by another package.
This may mean that the package is missing,has been obsoleted,or is only available from another source

E: Package 'libjpeg-turbo8' has no installation candidate

我正在使用64位debian.
我浏览网页找到解决方案,但幸运的是没有找到任何答案.
我怎样才能获得libjpeg-turbo8?

编辑:

所以我尝试了apt-get install wkhtmltopdf,尽管事实并非如此.

apt-get install wkhtmltopdf的问题是版本并不总是好的,我们应该使用0.12.1

但:

root@dev01:/opt/odoo/modules_scndf# apt-cache policy wkhtmltopdf 
wkhtmltopdf:
  Installed: 0.12.1-2
  Candidate: 0.12.1-2
  Version table:
 *** 0.12.1-2 0
         500 http://ftp.debian.org/debian/ jessie/main amd64 Packages
         100 /var/lib/dpkg/status

即使使用apt-get install wkhtmltopdf,版本似乎也不错,但是当我在odoo上启动我的打印时,我仍然得到

Unable to find Wkhtmltopdf on this system. The report will be shown in html.

这意味着他没有按照应有的安装.

编辑2:

现在当我尝试打印报告时,我得到一个弹出窗口:

Wkhtmltopdf Failed (Error code : -6). message : The switch 
--header-html,is not support using unpatched qt,and will be 
ignored.The switch --footer-html,and will be ignored.QXcbConnection: Could not connect to display

解决方法

Ubuntu和Debian软件包大多数时间是兼容的,但并非在所有情况下兼容,我认为这是你尝试使用Ubuntu的.deb代替Debian而不是你应该得到Debian特定文件的麻烦,(它适用于两者) jessie和wheezy)
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-wheezy-amd64.deb
sudo dpkg -i  wkhtmltox-0.12.1_linux-wheezy-amd64.deb

然后在/etc/init.d/openerp-server或/etc/init.d/odoo-server脚本中,取决于你拥有哪一个

例如,将/usr/local / bin添加到路径环境变量的前面,

PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin,

这告诉odoo在哪里查找它需要的系统二进制文件,或者你可以选择将文件复制到/usr/bin,如果你不想弄乱那些文件

sudo cp /usr/local/bin/wkhtmlto* /usr/bin/

大佬总结

以上是大佬教程为你收集整理的linux – 如何在debian 64位上正确安装wkhtmltopdf?全部内容,希望文章能够帮你解决linux – 如何在debian 64位上正确安装wkhtmltopdf?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。