Html2Pdf -Codeigniter - 图片未加载
Html2Pdf -Codeigniter -Image not loading
我正在为 codeigniter 使用 HTML2PDF 库
参见:https://github.com/aiwmedia/HTML2PDF-CI
我的问题是我无法使用标签加载图像。它始终显示 alt 属性而不是图像。尝试给出完整路径和相对路径。
查看:
<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 中加载。感谢支持
我正在为 codeigniter 使用 HTML2PDF 库
参见:https://github.com/aiwmedia/HTML2PDF-CI 我的问题是我无法使用标签加载图像。它始终显示 alt 属性而不是图像。尝试给出完整路径和相对路径。
查看:
<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 中加载。感谢支持