Header in PDF

Header in PDF


Posted in : PHP Posted on : January 14, 2011 at 1:19 PM Comments : [ 0 ]

This section contains the detail about the Header in PDF.

Header in PDF

In this tutorial you will learn how to generate Header in PDF  in a PHP web application.  The new instance of FPDF class, initial functions are empty you can extend the class and add your own functionality by overriding them. FPDF allows you to add  header into your file.

          The code of  'header.php' given below :  

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

class Example extends FPDF
{
function Header()
{
$this->SetFont('Times','B',16);
$this->Cell(0,10,'Header',1,0,'C');
$this->Ln(30);
}
}

$pdf=new Example();
$pdf->AddPage();
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,10,'Hello World!',0,1,'C');

$pdf->Output();
?>

  In this tutorial  create Example class that extends FPDF class and override Header()  function . Header() set font and  create one cell   with  content . In this tutorial create new instance of Example class that extends FPDF class and override Header() function .

Output :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


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

 
Tutorial Topics