Search code examples
imagefpdf

FPDF Including an image in fancytable


I'm trying to insert an image in a FPDF fancytable. I tried to put inside the fancytable function the following :

$this->Cell($w[1],6,$pdf->Image('lettre.jpg',0,0,20,0),'LRB',0,'C',$fill);

but I have (of course) the following error message :

PHP Notice: Undefined variable: pdf in /MyScript.php on line 143

Notice: Undefined variable: pdf in /MyScript.php on line 143

PHP Fatal error: Uncaught Error: Call to a member function Image() on null in /MyScript.php:143

Stack trace:

0 /MyScript.php(172): PDF->FancyTable(Array, Array)

1 {main} thrown in /MyScript.php on line 143

I understand that I call the pdf function inside the fancytable function (part of the pdf function), so do I have a solution ?

Thanks !


Solution

  • Damn, the answer was in the question : just replaced $pdf by $this and it fixed my problem..

    I let the question here just in case somebody have the same error one day ^^