linux – wkhtmltopdf – QXcbConnection:无法连接到显示器
如何运行wkhtmltopdf无头?!
在Debian Whezzy上安装
apt-get install wkhtmltopdf
命令
wkhtmltopdf --title "$SUBJECT" -q $SOURCEFILE $OUTPUTFILE
错误
QXcbConnection: Could not connect to display
解决方法:
这是a bug,修复程序尚未提交到Debian存储库.引用ashkulz(谁关闭了错误报告):
You’re using the version of wkhtmltopdf in the debian repositories, which does not support running headless.
所以你可以……
> Download wkhtmltopdf from source并编译它(参见the INSTALL.md file中的说明;如果已经安装了Qt 4.8,可以从他们的git clone行中删除–recursive选项).
>在xvfb,as suggested by masterkorp in the bug report中运行它.