I have consumed fpdf library and using it according the official documentation from fpdf.
I want to use header in my file but not able to use that, below is my code for same. Please correct my mistake why header is not coming..
Here is my code:
<?php
require('fpdf/fpdf.php');
class PDF extends FPDF
{
function Header()
{
// Select Arial bold 15
$this->SetFont('Arial','B',5);
// Move to the right
$this->Cell(80,'ddd');
// Framed title
$this->Cell(30,10,'Title',1,0,'C');
$this->Cell(20,10,'Title',1,1,'C');
// Line break
$this->Ln(20);
}
}
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times','B',14);
$pdf->Cell(20,10,'Title',1,1,'C');
$pdf->Output();
?>
Per PetrHejda's comment, all you should need to do is change
$pdf=new FPDF();
to
$pdf=new PDF();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With