0
我使用HTML2PDF库笨HTML2PDF -Codeigniter - 图像不加载
参见: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');
你有没有检查过,baseurl有一个名为uploads的子文件夹?您也可以尝试对图像进行64位编码并嵌入全部数据,而不仅仅是位置。 – cramopy
baseurl已经有了一个名为uploads的子文件夹。让我检查建议的其他解决方案。 –
您是否尝试过使用base64内容,别名为src =“data:image/jpg; base64,{$ base64contentofyourimage}”'? – cramopy