FPDF - Image


We can add images to pdf documents by using Image() function in FPDF.

Syntax
  Image($path,$x,$y,$width,$height,$type)
Example
<?php
  require('fpdf/fpdf.php');

  class PDF extends FPDF
  {
    function Header(){
      #shows image in actual size
      $this->Image("sample.jpg",5,5,0,0,"JPG");
      
      #shows image with given width and height
      $this->Image("sample.jpg",5,60,50,30,"JPG");
    }
  }
  
  $pdf=new PDF("P","mm","A4");
  $pdf->AddPage();
  $pdf->Output();
?>
Output