如何在CentOS 7 中安装wkhtmltopdf和wkhtmltoimage
工具说明
wkhtmltopdf和wkhtmltoimage是一个开源的命令行工具,可以将HTML转换为pdf文档和图片。
Github 仓库: wkhtmltopdf/wkhtmltopdf
官网: https://wkhtmltopdf.org/
在CentOS7上安装wkhtmltopdf
CentOS7 下,下载依赖12yum install -y xorg-x11-fonts-75dpiyum install -y xorg-x11-fonts-Type1
下载RMP包, RMP包可以从官网wkhtmltopdf.org下,也可以从Github下。1wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
在系统中安装RMP包1rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
测试:1wkhtmltopdf --encoding utf-8 https://www.baidu.com baidu.pdf
相关Ruby Gem
imgkit是Ruby的一个GEM,使用到了wkhtmltoimage命令,可以将HTML转换为图片。Github地址csquared/IMGKit
Reference
https://jaimegris.wordpress.com/2015/03/04/how-to-install-wkhtmltopdf-in-centos-7-0/