PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 19, 2022

[FIXED] Html2Pdf -Codeigniter -Image not loading

 February 19, 2022     codeigniter, html2pdf, php     No comments   

Issue

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

Solution

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.



Answered By - Blesson Christy
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing