Html2Pdf -Codeigniter-图片未加载 [英] Html2Pdf -Codeigniter -Image not loading
本文介绍了Html2Pdf -Codeigniter-图片未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用HTML2PDF库作为代码调试器
I am using HTML2PDF Library for codeigniter
请参阅: https://github.com/aiwmedia/HTML2PDF-CI
我的问题是我无法使用标签加载图像。它总是显示alt属性而不是图像。尝试给出完整路径和相对路径。
See:https://github.com/aiwmedia/HTML2PDF-CI My problem is i am unable to load images using tag. Instead of image it always shows alt attribute. Tried giving the full path and relative path.
视图:
<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
I solved the issue by editing dompdf_config.custom.inc.php
未注释的
define("DOMPDF_ENABLE_REMOTE", true);
现在图像已加载到pdf内。感谢您的支持。
Now the images are loading inside pdf. Thanks for the support.
这篇关于Html2Pdf -Codeigniter-图片未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文