Saturday, March 8, 2014

pdf using php and fpdf

how can we generate a pdf using php and fpdf

What is FPDF?

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
FPDF has other advantages: high level functions. Here is a list of its main features:

1. download fpdf packeage .
2. pdfExample.php 


$pdf = new FPDF();
$pdf->Cell(40,10,'Hello World!');

Header, footer, page break and image


class PDF extends FPDF
// Page header
function Header()
    // Logo
    // Arial bold 15
    // Move to the right
    // Title
    // Line break

// Page footer
function Footer()
    // Position at 1.5 cm from bottom
    // Arial italic 8
    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');

// Instanciation of inherited class
$pdf = new PDF();
    $pdf->Cell(0,10,'Printing line number '.$i,0,1);



Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, boolean fill [, mixed link]]]]]]])



// Times regular 12
// Arial bold 14
// Removes bold
// Times bold, italic and underlined 14


Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
  • Courier (fixed-width)
  • Helvetica or Arial (synonymous; sans serif)
  • Times (serif)
  • Symbol (symbolic)
  • ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is kept.
Font style. Possible values are (case insensitive):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline


1 comment:

  1. My friend Suggest me this blog and I can say this is the best blog to get the basic knowledge.Thank you so much for this Selenium Training in Chennai


Related Posts Plugin for WordPress, Blogger...