Image in PDF

Image in PDF


Posted in : PHP Posted on : January 15, 2011 at 6:47 PM Comments : [ 0 ]

This section contains the detail about the Image in PDF .

Image in PDF

In this tutorial you will learn how to display image in PDF in a PHP web application. In this tutorial create PDF that display one cell with content and image . The code 'image-pdf.php'  given below :

<?php
require('fpdf16/fpdf.php');

$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times','I',16);
$pdf->Cell(0,10,'Display Image');
$pdf->Image('flower1.jpeg',10,30,30,30);

$pdf->Output();
?>

In the ''image-pdf.php'' file : 

  • First we have included the fpdf library in our file.
  • Then we have created a new instance of FPDF class.
  • Next we add a blank page in pdf document.
  • Next we have set the page font.
  • Next we have created a cell with parameters width, height and content.
  • Next  we have created a image with parameters image,x, y,width,height.
  • Then We will output it to the browser.

Output :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics