Search code examples
phpfpdf

FPDF - How to fix the "Fatal error: Call to undefined method PDF::FPDF()" Using Write_html


I am using this script http://fpdf.org/en/script/script50.php and I am getting the error:

Fatal error: Call to undefined method PDF::FPDF() in MyPath/html_table.php on line 55

it is this call to FPDF that is throwing the exception :

$this->FPDF($orientation,$unit,$format);

I don't understand why, knowing that the pdf class extends FPDF and I have the fpdf.php file in the same directory as the html_table.php file, is there any way to fix this error? Thank you


Solution

  • Fixed it.

    I actually needed to replace :

    $this->FPDF($orientation,$unit,$format);
    

    by:

    $this->__construct($orientation,$unit,$format);
    

    The original script has this error, so for anyone wanting to use the script don't forget to fix this error first. Good luck.