wkhtmltopdf bug
来源:互联网 发布:c语言函数大全 chm 编辑:程序博客网 时间:2024/06/06 20:32
遇见
在 Ubuntu Server 的命令行执行python 命令 pdfkit 把HTML 转为PDF时异常:
IOError: wkhtmltopdf exited with non-zero code -6. error:QXcbConnection: Could not connect to display
原因
问题原因不是很清楚,大概是因为没有界面显示,没有解析HTML的模块。总之少了某些依赖。
解决
安装xvfb,貌似是个可以模拟显示设备的库。
sudo apt-get install xvfb
运行xvfb服务, 为了避免显示设备冲突,指定一个编号,这里是 10
sudo Xvfb :10 -ac
指定显示设备,和上面的编号一致
export DISPLAY=:10
执行 pdfkit 代码。
后记
有可能还需要安装个浏览器 firefox, 我装了,但是感觉不需要。
sudo apt-get updatesudo apt-get install firefox
是参考这篇文章解决的,非常感谢:
https://segmentfault.com/a/1190000000619224
阅读全文
0 0
- wkhtmltopdf bug
- wkhtmltopdf
- wkhtmltopdf error
- Ubuntu 编译 wkhtmltopdf
- linux下使用wkhtmltopdf
- ubuntu安装wkhtmltopdf
- ubuntu安装wkhtmltopdf
- wkhtmltopdf 中文参数详解
- wkhtmltopdf 中文参数详解
- 使用wkhtmltopdf打印pdf
- wkhtmltopdf 中文参数详解
- 在debian8安装wkhtmltopdf
- wkhtmltopdf 缩放问题
- wkhtmltopdf 设置 cookie
- wkhtmltopdf.exe >>html to PDF
- 【wkhtmltopdf】关于页面打印pdf
- wkhtmltopdf参数设置和下载PDF
- IOError: No wkhtmltopdf executable found: ""
- AIDL 入门
- 使用Intellij ide在Azure上搭建JavaWeb项目
- Unity编辑器扩展
- pure seq2seq
- ORA-12005: may not schedule automatic refresh for times in the past
- wkhtmltopdf bug
- web前端需要具备SEO技能吗
- Netty4实战第一章:Netty和Java NIO APIs
- 内联函数
- 使用@Retryable来进行重处理
- nfs挂载
- 双路快排
- golang中并发sync和channel
- python机器学习与实战中运行代码出现警告的处理