wkhtmltopdf:无法连接到 X 服务器 [英] wkhtmltopdf: cannot connect to X server
问题描述
我一直在使用 wkthmltopdf 将 html 即时转换为 pdf 文档我的 linux 网络服务器.该程序最初需要 X11 或类似的 X 服务器才能正确运行,但通过开发人员的许多请求,使其在没有 GUI 的服务器上运行,我很确定它在 静态版本.我一直在使用该程序的静态(独立)版本,效果很好!我会将可执行文件放在一个文件夹中,然后运行:
I have been using wkthmltopdf to convert html to pdf documents on-the-fly on my linux web server. The program originally needed X11 or similar X server to run correctly, but through many requests by developers to have this run on servers without GUI, I am pretty sure it runs a virtual X server in the static version. I have been using the static (stand-alone) version of the program and it works great! I would put the executable file in a folder, and run:
./wkhtmltopdf file1.html file2.pdf
但是我想在系统范围内安装这个程序.我使用了 apt-get install wkhtmltopdf
(昨天刚安装),因为我在 64 位系统上运行,所以我还需要 apt-get install ia32-libs
.安装后我可以找到这样的版本:
However I would like to install this program system-wide. I used the apt-get install wkhtmltopdf
(just installed yesterday) and since I am running on a 64 bit system, I also needed apt-get install ia32-libs
. After installation I can find the version like this:
wkhtmltopdf --version
输出:
Name:
wkhtmltopdf 0.9.9
License:
Copyright (C) 2008,2009 Wkhtmltopdf Authors.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
Authors:
Written by Jakob Truelsen. Patches by Mário Silva, Benoit Garret and Emmanuel
Bouthenot.
现在,当我尝试运行通过 aptitude 安装的程序时,出现以下错误:
Now when I try to run the program installed via aptitude, I get the following error:
wkhtmltopdf: cannot connect to X server
有谁知道我该如何解决这个问题?我猜这个版本缺少虚拟 X 服务器之类的东西.
Does anyone know how I can fix this? I guess this version is missing a virtual X server or something.
推荐答案
我刚刚发现我可以简单地将静态可执行文件移动到 /usr/bin/
目录并从任何地方执行它.
I just figured out that I can simply move the static executable to the /usr/bin/
directory and execute it from anywhere.
这篇关于wkhtmltopdf:无法连接到 X 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!