Html2Pdf -Codeigniter -Image not loading

时间秒杀一切 提交于 2020-01-04 08:21:26

问题


I am using HTML2PDF Library for codeigniter

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.

View:

<img src="<?php echo base_url(); ?>/uploads/pdf_images/1.jpg" alt="<?php echo base_url(); ?>uploads/pdf_images/1.jpg"/>

Controller:

$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');

回答1:


I solved the issue by editing dompdf_config.custom.inc.php

uncommented

define("DOMPDF_ENABLE_REMOTE", true);

Now the images are loading inside pdf. Thanks for the support.



来源:https://stackoverflow.com/questions/46988041/html2pdf-codeigniter-image-not-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!