红联Linux门户
Linux帮助

unable to install wkhtmltopdf with patched qt in ubuntu

发布时间:2017-07-16 09:21:48来源:linux网站作者:木葉清风
报错如下:
Traceback (most recent call last):
File "runoob2pdf.py", line 156, in <module>
main()
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "runoob2pdf.py", line 146, in main
save_pdf(htmls, file_name)
File "runoob2pdf.py", line 120, in save_pdf
pdfkit.from_file(htmls, file_name, options=options)
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/pdfkit/api.py", line 49, in from_file
return r.to_pdf(output_path)
File "/home/itcast/git-project/py34env/lib/python3.4/site-packages/pdfkit/pdfkit.py", line 159, in to_pdf
raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr))
OSError: wkhtmltopdf exited with non-zero code -6. error:
The switch --outline-depth, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display 
 
解决方法:
sudo apt-get update
sudo apt-get install libxrender1 fontconfig xvfb
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -P /tmp/
cd /opt/
sudo tar xf /tmp/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31991.html