Reputation: 88
I am currently following this tutorial in Codeigniter and was wondering how I can add an image to a pdf, the manual on ezpdf's page doesn't specifically state on what kind of path I need to input, I tried everything and the PDF just would not load or show an image.
For your reference I am using the code below to add an image.
$image = base_url()."system/application/images/logo.jpg";
$this->cezpdf->ezImage( $image );
Upvotes: 1
Views: 6460
Reputation: 88
I ended up using fpdf with codeigniter and here's how I added the image
function setReportGeneralPageHead($report_name, $print_date){
$this->fpdf->Image(base_url().'system/application/images/somelogo.jpg',10,3,60,0,'');
$this->fpdf->Image(base_url().'system/application/images/another-logo.png',225,10,60,0,'');
$this->fpdf->SetFont('Arial','',11);
$this->fpdf->Cell(140,45,$report_name,'',0,'L');
$this->fpdf->SetFont('Arial','',11);
$this->fpdf->Cell(135,45, "Generated on: ".$print_date,'',0,'R');
//$this->fpdf->Line(20, 20, 190, 20);
$this->fpdf->Ln(15);
}
Upvotes: 1
Reputation: 7330
I used site_url()
and it works for me:
$this->cezpdf->ezImage(site_url("image_path"));
cezpdf fopen
s the url and caches it in its temp directory.
Upvotes: 0