Linux安装:wkhtmltopdf
- 安装软件
- 2025-07-09
- 104热度
- 0评论
1、安装
1.1、yum安装
yum install -y wkhtmltopdf
安装的版本是0.12.1
2、使用
2.1、如果系统安装了GUI
直接使用
wkhtmltopdf http://www.baidu.com baidu.pdf
2.2、如果系统没有GUI
创建脚本 wkhtmltopdf2
xvfb-run wkhtmltopdf --footer-font-size 10 --footer-center [page]/[topage] --dpi 110 --disable-smart-shrinking --margin-left 0mm --margin-right 0mm --margin-top 15mm --margin-bottom 12mm --outline --outline-depth 4 "$@"
可以如下使用:
wkhtmltopdf2 http://www.baidu.com baidu.pdf
如果系统报错:xvfb-run 命令未找到,需要安装Xvfb
yum install -y Xvfb
3、中文乱码
安装中文字体