Tuesday, 26 November 2019

Error in generating pdf with FPDF library

I am trying to generate the PDF with the help of PDF library.It gives me following error what may be the reason .

Fatal error: Uncaught Error: Call to undefined method FPDF::headerTable() in C:\xampp\htdocs\geochronology\library\admin\generatepdf1.php:26 Stack trace: #0 {main} thrown in C:\xampp\htdocs\geochronology\library\admin\generatepdf1.php on line 26

<?php
require_once("includes/config.php");
//

require('C:\xampp\htdocs\geochronology\vendor\setasign\fpdf\fpdf.php');
require('C:\xampp\htdocs\geochronology\vendor\setasign\fpdi\src\autoload.php');
require('C:\xampp\htdocs\geochronology\vendor\setasign\fpdi\src\fpdi.php');
    class mypdf extends FPDF{
        function headerTable(){
        $this->setfont('Arial','B',12);
        $this->cell(20,10,'SL_NO',1,0,'c');
        $this->cell(20,10,'USER NAME' ,1,0,'c');
        $this->cell(20,10,'AFFILIATION',1,0,'c');
        $this->cell(20,10,'SAMPLE TYPE' ,1,0,'c');
        $this->cell(20,10,'SAMPLE ID',1,0,'c');
        $this->cell(20,10,'DATE',1,0,'c');
        $THIS->Ln();        
        }



    }
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage('L','A4',0);
$pdf->headerTable();
$pdf->output();


?>


from Error in generating pdf with FPDF library

No comments:

Post a Comment