×

PHP wkhtmltoimage 生成 图片或pdf

chen chen 发表于2021-07-27 22:08:10 浏览503 评论0

抢沙发发表评论

下载安装包地址
https://github.com/wkhtmltopdf/wkhtmltopdf/releases
https://github.com/wkhtmltopdf/packaging/releases/0.12.6-1
rpm -ivh wkhtmltox-0.12.6-1.centos6.x86_64.rpm
如果提示  缺失   xorg-x11-fonts-75dpi
  rpm -ivh wkhtmltox-0.12.6-1.centos7.x86_64.rpm
  yum install xorg-x11-fonts-75dpi.noarch
 
  yum install xorg-x11-fonts-Type1.noarch
测试  /usr/local/bin/wkhtmltopdf http://www.baidu.com output.pdf
/usr/local/bin/wkhtmltoimage http://www.baidu.com output_2.png
PHP代码
error_reporting(E_ALL);
ini_set('display_errors', '1');
set_time_limit(0);
shell_exec("/usr/local/bin/wkhtmltoimage http://www.baidu.com output_2.png");
shell_exec("/usr/local/bin/wkhtmltopdf http://www.baidu.com output_2.pdf");




群贤毕至

访客