FPDF Header on First Page Only

We can make header using Header() method in FPDF. Header() method would show header content in all pages.We have to, use PageNo () in conditional statements to show header on first page only.

The following example shows, how to show header on first page only in FPDF.


  class PDF extends FPDF{
    function Header(){
      //Display Header Content, if page number eqaul 1
      if ($this->PageNo() == 1 ) {
        //Header Content
        $this->Cell(0,15,'HEADER TEXT',0,1,"C");

  $pdf=new PDF("P","mm","A4");
    $pdf->Cell(0,15,"Line ".($i+1),0,1);