wkhtmltox html快速转成image或pdf

安装测试

方式一:

官网下载安装包 wkhtmltox-0.12.5-1.centos7.x86_64.rpm
https://wkhtmltopdf.org/

Linux 本地安装 yum localinstall wkhtmltox-0.12.5-1.centos7.x86_64.rpm

测试是否安装成功
wkhtmltopdf http://www.baidu.com /data1/baidu.pdf

pdf 中文不显示问题:
打开windows c:\Windows\fonts\simsun.ttc拷贝到linux服务器/usr/share/fonts/目录下,

 

方式二
下载包
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

解压
tar xvfJ wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
进入解压包目录
cd wkhtmltox/bin

创建快捷方式
sudo mv ./wkhtmltopdf /usr/bin/wkhtmltopdf

sudo chmod +x /usr/bin/wkhtmltopdf

安装依赖包
yum install libXrender*
linux wkhtmltopdf 执行 ./wkhtmltopdf --version 报错

./wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory,执行 apt-get/yum install libXrender*

运行 wkhtmltopdf 报wkhtmltopdf: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory这个错,请运行apt-get/yum install libfontconfig*

运行 wkhtmltopdf 报wkhtmltopdf: error while loading shared libraries: libXext.so.6: cannot open shared object file: No such file or directory这个错,请运行 apt-get/yum install libXext*

 

posted @ 2019-08-02 15:01  陈俊武  阅读(1312)  评论(0编辑  收藏  举报