PHP 7 FPDF Example to Display Header on First Page Only in PDF Document Using HTML5 & Javascript
<?php
require('fpdf/fpdf.php');
class PDF extends FPDF{
function Header(){
//Display Header Content, if page number eqaul 1
if ($this->PageNo() == 1 ) {
//Header Content
$this->SetFont('Arial','B',15);
$this->Cell(0,15,'HEADER TEXT',0,1,"C");
$this->Line(0,30,210,30);
$this->Ln();
}
}
}
$pdf=new PDF("P","mm","A4");
$pdf->AddPage();
$pdf->SetFont('Arial','',15);
for($i=0;$i<35;$i++)
{
$pdf->Cell(0,15,"Line ".($i+1),0,1);
}
$pdf->Output();
?>