【发布时间】:2021-09-15 06:05:04
【问题描述】:
我正在使用 cakepdf 插件在 cakephp 应用程序中生成 pdf。 我正在为 dompdf 使用以下配置
Configure::write('CakePdf', [
// 'engine' => 'CakePdf.WkHtmlToPdf',
'engine' => 'CakePdf.DomPdf',
'margin' => [
'bottom' => 15,
'left' => 50,
'right' => 30,
'top' => 45
],
'orientation' => 'landscape',
'download' => false,
'isRemoteEnabled'=> true
// 'enable-local-file-access' => true
]);
我已添加'isRemoteEnabled'=> true
我用过的显示图片
<img src="<?= WWW_ROOT ?>img/4dx/01/00.png" />
我也试过了
<?php echo $this->Html->image('4dx/01/00.png', ['fullBase' => true]); ?>
相同的结果没有发现任何变化。 $this->Html->image 这种方式也不适用于 WkHtmlToPdf。我正在使用 PHP 版本 7.4.x
如果我使用 WkHtmlToPdf 引擎,此图像完美显示,但对于 dompdf,我没有得到图像,它显示未找到。如下图所示
【问题讨论】:
标签: cakephp dompdf cakephp-4.x