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。