FPDF


FPDF is a PHP class which allows to generate PDF files with PHP Script. FPDF stands for Free PDF. You can use it for any kind of usage and modify it to suit your needs.

Main features are :

  • Choice of measure unit, page format and margins.
  • Page header and footer management.
  • Automatic page break and line break.
  • Automatic text justification.
  • Image support (JPEG, PNG and GIF).
  • Colors and Links
  • TrueType, Type1 and encoding support.
  • Page compression.

Download FPDF Class from http://www.fpdf.org/en/download.php and extract zip file into fpdf folder. The following example shows, how to create simple pdf using FPD in PHP.

Example
<?php
 require('fpdf/fpdf.php');
 
 //create an FPDF object
 $pdf=new FPDF("P","mm","A4"); 
 
 //or custom page size
 //$pdf=new FPDF("P","mm",array(150,250)); 
 
 //Add Blank Page
 $pdf->AddPage();  

 //Set Font,Style,Size 
 $pdf->SetFont("Arial","B",15);  
 
 //Prints a cell with borders , alignment and fill background .
 $pdf->Cell(25,15,"Hello",1,0,"C",false);
 
 // Close document and sent to the browser
 $pdf->Output();
 
?>
Output

Reference : http://www.fpdf.org/