我正在使用 HTML2PDF 库作为 codeigniter
See:https://github.com/aiwmedia/HTML2PDF-CI https://github.com/aiwmedia/HTML2PDF-CI我的问题是我无法使用标签加载图像。它总是显示 alt 属性而不是图像。尝试给出完整路径和相对路径。
View:
<img src="<?php echo base_url(); ?>/uploads/pdf_images/1.jpg" alt="<?php echo base_url(); ?>uploads/pdf_images/1.jpg"/>
控制器:
$this->load->library('html2pdf');
$this->html2pdf->folder(APPPATH."third_party/samples/");
$file_name=$this->random_string(7);
$this->html2pdf->filename($file_name.'.pdf');
$this->html2pdf->paper('a4', 'portrait');
//$this->html2pdf->html($this->load->view('pdfcouple',$data,true));
if($user_details_arr[0]->is_married)
{
$content=$this->load->view('pdfcouple', $data, true);
}
$this->html2pdf->html($content);
$this->html2pdf->create('save');
我通过编辑 dompdf_config.custom.inc.php 解决了这个问题
未注释的
define("DOMPDF_ENABLE_REMOTE", true);
现在图像正在 pdf 中加载。感谢您的支持。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)