Can you pleas help me with this code....
<?php
require('fpdf/fpdf.php');
class PDF_reciept extends FPDF
{
function __construct($orientation = 'P', $unit = 'pt', $format = 'Letter', $margin = 40)
{
$this->FPDF($orientation, $unit, $format);
$this->SetTopMargin($margin);
$this->SetLeftMargin($margin);
$this->SetRightMargin($margin);
$this->SetAutoPageBreak(true, $margin);
}
function Header()
{
$this->SetFont('Arial', 'B', 20);
$this->SetFillColor(36, 96, 84);
$this->SetTextColor(225);
$this->Cell(0, 30, "Nettuts+ Online Store", 0, 1, 'C', true);
}
function Footer()
{
$this->SetFont('Arial', '', 12);
$this->SetTextColor(0);
$this->XY(40, -60);
$this->Cell(0, 20, "Thank you for shopping at Nettuts+", 'T', 0, 'C');
}
}
$pdf = new PDF_reciept();
$pdf->Output();
?>
You are overriding the constructor, so you have to call parent constructor with expected signature, like parent::__construct();
on top of your constructor function:
public function __construct($orientation = 'P', $unit = 'pt', $format = 'Letter', $margin = 40)
{
parent::__construct($orientation, $unit, $format, $margin);
//$this->FPDF($orientation, $unit, $format);
$this->SetTopMargin($margin);
$this->SetLeftMargin($margin);
$this->SetRightMargin($margin);
$this->SetAutoPageBreak(true, $margin);
}
Also all functions within your class should be declared with access modifier (public, private etc.)