wkhtmltox html快速转成image或pdf

本文详细介绍了在Linux环境下安装wkhtmltopdf的方法,包括从官网下载rpm包和使用wget下载tar.xz包两种方式,并提供了安装步骤及解决安装过程中遇到的如字体显示、共享库缺失等问题的方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装测试

方式一:

官网下载安装包 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*

 

转载于:https://www.cnblogs.com/chenjunwu/p/11288621.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值