Cakephp 找不到CakePdf插件wkhtmltopdf二进制文件

Cakephp 找不到CakePdf插件wkhtmltopdf二进制文件,cakephp,wkhtmltopdf,Cakephp,Wkhtmltopdf,我正在尝试实现这个插件 在我的视图方法中,我添加了以下代码 public function view($id = null) { $this->User->id = $id; $this->autoRander="false"; if (!$this->User->exists()) { throw new NotFoundException(__('Invalid user'));

我正在尝试实现这个插件

在我的视图方法中,我添加了以下代码

   public function view($id = null) {
       $this->User->id = $id;
        $this->autoRander="false";
        if (!$this->User->exists()) {
            throw new NotFoundException(__('Invalid user'));
        }
          $this->pdfConfig = array(
                'orientation' => 'portrait',
                'filename' => 'User_' . $id
            );

        $this->set('user', $this->User->read(null, $id));
    }
我还要补充一点

 Configure::write('CakePdf', array(
        'engine' => 'CakePdf.WkHtmlToPdf',
        'options' => array(
            'print-media-type' => false,
            'outline' => true,
            'dpi' => 96
        ),
        'margin' => array(
            'bottom' => 15,
            'left' => 50,
            'right' => 30,
            'top' => 45
        ),
        'orientation' => 'landscape',
        'download' => true
    ));
现在的问题是,当我试图执行给我这个错误的代码时,wkhtmltopdf二进制文件找不到或不可执行:/usr/bin/wkhtmltopdf我已经安装了wkhtmltopdf。这里是他们使用的CakePdf插件代码

protected $binary = '/usr/bin/wkhtmltopdf';

如何使用此引擎来解决它?如何确定此路径?

在命令shell中wkhtmltopdf
在哪里。

在命令shell中wkhtmltopdf
在哪里。

如果使用MAMP change

// app/Plugin/CakePdf/Pdf/Engine/WkHtmlToPdfEngine.php
protected $binary = '/usr/bin/wkhtmltopdf';


如果您正在使用MAMP更改

// app/Plugin/CakePdf/Pdf/Engine/WkHtmlToPdfEngine.php
protected $binary = '/usr/bin/wkhtmltopdf';


我也面临同样的问题。在我的Mac电脑上,正确的路径是
/usr/local/bin/wkhtmltopdf
。 为了覆盖默认路径,我在
Configure::write
块中添加了一行:

Configure::write('CakePdf', array(
    'binary' => '/usr/local/bin/wkhtmltopdf', // set the correct path here
    'engine' => 'CakePdf.WkHtmlToPdf',
    'options' => array(
        'print-media-type' => false,
        'outline' => true,
        'dpi' => 96
    ),
    'margin' => array(
        'bottom' => 15,
        'left' => 50,
        'right' => 30,
        'top' => 45
    ),
    'orientation' => 'landscape',
    'download' => true
));

我也面临同样的问题。在我的Mac电脑上,正确的路径是
/usr/local/bin/wkhtmltopdf
。 为了覆盖默认路径,我在
Configure::write
块中添加了一行:

Configure::write('CakePdf', array(
    'binary' => '/usr/local/bin/wkhtmltopdf', // set the correct path here
    'engine' => 'CakePdf.WkHtmlToPdf',
    'options' => array(
        'print-media-type' => false,
        'outline' => true,
        'dpi' => 96
    ),
    'margin' => array(
        'bottom' => 15,
        'left' => 50,
        'right' => 30,
        'top' => 45
    ),
    'orientation' => 'landscape',
    'download' => true
));

“我已安装wkhtmltopdf。”,“如何确定此路径”。这告诉我他已经安装了wkhtmltopdf,但它不在代码期望的位置,他想确定二进制文件的路径。如果是这样的话,我的答案是正确的。如果我有误解,我会让作者告诉我其他的。@Alimon Karim顺便说一句这句话
$this->autoRander=“false”不会做任何事情。属性名为
autoRender
,它的值必须是布尔值而不是字符串。我在引擎上遇到问题。我需要WkHtmlToPdf的帮助。我已经安装了它,但它不工作。它在live server中工作吗?“我已经安装了wkhtmltopdf。”,“如何确定此路径”。这告诉我他已经安装了wkhtmltopdf,但它不在代码期望的位置,他想确定二进制文件的路径。如果是这样的话,我的答案是正确的。如果我有误解,我会让作者告诉我其他的。@Alimon Karim顺便说一句这句话
$this->autoRander=“false”不会做任何事情。属性名为
autoRender
,它的值必须是布尔值而不是字符串。我在引擎上遇到问题。我需要WkHtmlToPdf的帮助。我已经安装了它,但它不工作。它在live server中工作吗?