Wkhtmltopdf 失败 (错误代码: -6). 消息: 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.QXcbConnection: Could not connect to display
解决方案如下:
使用源码安装wkhtmltopdf,步骤如下:
1、通过github下载源码,存放在本地/home下的wkhtmltopdf目录中.
git clone https://github.com/wkhtmltopdf/wkhtmltopdf.git
2、安装编译环境,针对我当前的版本,需要执行命令如下:
sudo scripts/build.py setup-schroot-jessie
3、为64位系统进行编译:
scripts/build.py jessie-amd64
如果出现了错误信息,请检查依赖,并进行如下修复:
apt-get install debootstrap schroot rinse git
重新执行步骤2,3。