如何在 debian 64 位上正确安装 wkhtmltopdf? [英] How to correctly install wkhtmltopdf on debian 64 bit?

查看:126
本文介绍了如何在 debian 64 位上正确安装 wkhtmltopdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 wkhtmltopdf,但是当我这样做时:

I am trying to install wkhtmltopdf, but when I do:

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?

I'm using a 64 bit debian. I browsed the web to find a solution but infortunately didn't find any answers. How can I get the libjpeg-turbo8?

所以我尝试了 apt-get install wkhtmltopdf 尽管实际上不推荐这样做.

So I tried apt-get install wkhtmltopdf despite the fact it wasn't recommended.

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

The probleme with apt-get install wkhtmltopdf is that the version isn't always the good one and we should use 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 上启动我的打印时,我仍然得到

Version seems to be the good one even with apt-get install wkhtmltopdf but when I launch my print on odoo I still get

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

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

Which means he didn't installed as it should have.

编辑 2:

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

Now when I try to print the report, I get a popup:

Wkhtmltopdf failed (Error code : -6). Message : 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.QXcbConnection: Could not connect to display 

推荐答案

Ubuntu 和 Debian 软件包在大多数情况下是兼容的,但并非在所有情况下,我认为这是您在尝试使用 Ubuntu 的 .deb 对于 Debian,您应该获取 Debian 特定文件,(它适用于 jessie 和 wheezy)

Ubuntu and Debian packages are compatible most times but not in all cases, i think this is the trouble you're having you're trying to use the Ubuntu's .deb for Debian instead you should get the Debian specific file, (it works for both jessie and 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 脚本中,具体取决于您的你有一个

Then in the /etc/init.d/openerp-server or /etc/init.d/odoo-server script(s), depending on your which one you have

例如在path环境变量前面添加/usr/local/bin

add /usr/local/bin to the front of path environment variable for example,

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

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

This tells odoo where to look for system binaries it requires or optionally you can copy the files to /usr/bin, if you don't want to mess with those files

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

这篇关于如何在 debian 64 位上正确安装 wkhtmltopdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆