【发布时间】:2014-06-01 09:15:39
【问题描述】:
我正在尝试实现这个插件https://github.com/ceeram/CakePdf
在我的视图方法中,我添加了这段代码
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 binary is not found or not executable: /usr/bin/wkhtmltopdf 我已经安装了 wkhtmltopdf。在他们使用的 CakePdf 插件代码中
protected $binary = '/usr/bin/wkhtmltopdf';
如何使用这个引擎来解决?如何确定这条路径?
【问题讨论】:
标签: cakephp wkhtmltopdf