如何使用wkhtmltopdf和wkhtmltoimage将网页完美截图成图片?
- 内容介绍
- 文章标签
- 相关推荐
本文共计186个文字,预计阅读时间需要1分钟。
在CentOS 7上安装wktopdf,请下载对应的RPM软件包:[https://github.com/wktopdf/packaging/releases/download/0.12.6-1/wktox-0.12.6-1.centos7.x86_64.rpm](https://github.com/wktopdf/packaging/releases/download/0.12.6-1/wktox-0.12.6-1.centos7.x86_64.rpm)。使用yum localinstall命令安装:`yum localinstall wktox-0.12.6-1.centos7.x86_64.rpm`。查看版本信息。
在CentOS7上安装wkhtmltopdf
下载wkhtmltopdf的RPM软件包:
github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstallwkhtmltox-0.12.6-1.centos7.x86_64.rpm
查看版本
wkhtmltopdf --version
wkhtmltoimage --version
解决中文乱码问题:把C:\Windows\Fonts 的ttf字体 拷贝到服务器/usr/share/fonts 中
执行命令:wkhtmltoimage --encoding utf-8--crop-w 410 --width 410 --quality 50 xxx.xxx.com test.jpg
本文共计186个文字,预计阅读时间需要1分钟。
在CentOS 7上安装wktopdf,请下载对应的RPM软件包:[https://github.com/wktopdf/packaging/releases/download/0.12.6-1/wktox-0.12.6-1.centos7.x86_64.rpm](https://github.com/wktopdf/packaging/releases/download/0.12.6-1/wktox-0.12.6-1.centos7.x86_64.rpm)。使用yum localinstall命令安装:`yum localinstall wktox-0.12.6-1.centos7.x86_64.rpm`。查看版本信息。
在CentOS7上安装wkhtmltopdf
下载wkhtmltopdf的RPM软件包:
github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstallwkhtmltox-0.12.6-1.centos7.x86_64.rpm
查看版本
wkhtmltopdf --version
wkhtmltoimage --version
解决中文乱码问题:把C:\Windows\Fonts 的ttf字体 拷贝到服务器/usr/share/fonts 中
执行命令:wkhtmltoimage --encoding utf-8--crop-w 410 --width 410 --quality 50 xxx.xxx.com test.jpg

