我正在尝试在脚本中实现cakepdf
在路线中,我添加了pdf扩展名
Router::extensions(['pdf']);
我还加载了dompdf
在标签控制器中,我添加了以下代码
public function initialize()
{
parent::initialize();
Configure::write('CakePdf', [
'engine' => 'CakePdf.DomPdf',
'margin' => [
'bottom' => 15,
'left' => 50,
'right' => 30,
'top' => 45
],
'orientation' => 'landscape',
'download' => true
]);
}
还在view.ctp中添加了视图构建器
public function view($id = null)
{
$tag = $this->Tags->get($id, [
'contain' => ['Bookmarks']
]);
$this->viewBuilder()->options([
'pdfConfig' => [
'filename' => 'Invoice_' . $id
]
]);
$this->set('tag', $tag);
}
我的输出低于