linux 安装Wkhtmltox

centos安装

# wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
# rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm
复制代码

正常系统安装并update后会提示缺少依赖信息:

error: Failed dependencies:
	fontconfig is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	freetype is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	libpng is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	libjpeg is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	libX11 is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	libXext is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	libXrender is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	xorg-x11-fonts-Type1 is needed by wkhtmltox-1:0.12.2.1-1.x86_64
	xorg-x11-fonts-75dpi is needed by wkhtmltox-1:0.12.2.1-1.x86_64
复制代码

这里直接按照提示的安装包就可以了

# yum install fontconfig freetype libpng libjpeg libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
复制代码

然后再次执行安装命令,就会成功安装了

# rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm
# wkhtmltopdf -V
# wkhtmltopdf --enable-forms https://www.baidu.com baidu.pdf
复制代码
分类:
后端
标签: