centos7安装Wkhtmltopdf

官网下载预编译版安装:

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.3_linux-generic-amd64.tar.xz
cd wkhtmltox/bin
sudo mv ./wkhtmltopdf /usr/bin/wkhtmltopdf
sudo chmod +x /usr/bin/wkhtmltopdf

测试: wkhtmltopdf http://www.baidu.com ./test.pdf

此时如果生成的字符都是方块,那么安装standard PostScript fonts: yum install urw-fonts libXext openssl-devel

如果中文不显示,则将 windows下的字体,例如simsun.ttc ,或者msyh.ttf,或者msyhbd.ttf 复制到 linux系统 /usr/share/fonts 下

参考:https://blog.csdn.net/qw_xingzhe/article/details/80607283

原文地址:https://www.cnblogs.com/itpython/p/10624104.html