Archit
Archit

Reputation: 139

fpdf: header not working in fpdf

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();
?>

Upvotes: 4

Views: 4477

Answers (1)

sql_dru
sql_dru

Reputation: 311

Per PetrHejda's comment, all you should need to do is change

$pdf=new FPDF();

to

$pdf=new PDF();

Upvotes: 9

Related Questions