FriendsOfCake CakePdf在版本3.8.5中不起作用

时间:2019-10-20 09:46:43

标签: cakephp cakephp-3.x

我正在尝试在脚本中实现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);
    }

我的输出低于

enter image description here

0 个答案:

没有答案