我正在尝试使用wkhtmltopdf
将HTML文档转换为PDF,使用'knplabs / snappy'中的包装器。我收到以下错误:
abcd1234string(95)“vendor / h4cc / wkhtmltopdf-amd64 / bin / wkhtmltopdf-amd64 --lowquality'http://google.com''test.pdf'”array(1){[“some”] => string(6)“option”} 致命错误:未捕获的RuntimeException:退出状态代码'126'表示出错:stderr:“sh:vendor / h4cc / wkhtmltopdf-amd64 / bin / wkhtmltopdf-amd64:无法执行二进制文件”stdout:“”命令:vendor / h4cc / wkhtmltopdf-amd64 / bin / wkhtmltopdf-amd64 --lowquality'/var/tmp/knp_snappy58f965265c7ce3.93342883.html''/tmp/bill-123.pdf'。在/Users/shubhamjoshi/projects/rsvp/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php:336堆栈跟踪:#0 / Users / shubhamjoshi / projects / rsvp / vendor / knplabs / knp-snappy /src/Knp/Snappy/AbstractGenerator.php(151):Knp \ Snappy \ AbstractGenerator-> checkProcessStatus(126,'','sh:vendor / h4cc ...','vendor / h4cc / wkh ......' )#1 /Users/shubhamjoshi/projects/rsvp/vendor/knplabs/knp-snappy/src/Knp/Snappy/Pdf.php(62):Knp \ Snappy \ AbstractGenerator-> generate(Array,'/ tmp / bill -123.p ...',Array,false)#2 /Users/shubhamjoshi/projects/rsvp/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php(170):Knp \ Snappy \ Pdf - > generate(Array,'/ tmp / bill-123.p ...',Array,false)#Users / shubhamjoshi / users / shubhamjoshi / projects / rsvp / vendor / knplabs / knp-snappy / src第336行/Knp/Snappy/AbstractGenerator.php
这是我的PHP代码:
<?php
echo ("abcd1234");
array('some' => 'option'));
require_once __DIR__ . '/vendor/autoload.php';
use Knp\Snappy\Pdf;
// Create a new Pdf object with some global PDF options
$snappy = new Pdf('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-
amd64');
var_dump($snappy->getCommand('http://google.com', 'test.pdf'),
array('some' => 'option'));
$snappy->generateFromHtml('<h1>Bill</h1><p>You owe me money, dude.
</p>', '/tmp/bill-123.pdf');
?>
请帮我解决此错误。