Home > database >  Call to undefined method PDF::setSourceFile()
Call to undefined method PDF::setSourceFile()

Time:08-10

I'm in big trouble atm, and I'm trying to add a watermark to an existing pdf using fpdf rotate script for fpdf. But when I try to set the source file, it prints that function setSourceFile() doesn't exist. I searched at google and StackOverflow, and many codes use this method, but I returned this error. Could anyone help me?

Error:

Fatal error: Uncaught Error: Call to undefined method PDF::setSourceFile() in C:\xampp\htdocs\index.php:18 Stack trace: #0 {main} thrown in C:\xampp\htdocs\index.php on line 18

My code:

<?php
require('rotation.php');
class PDF extends PDF_Rotate{
    function Header(){
        //Put the watermark
        $this->SetFont('Arial','B',50);
        $this->SetTextColor(255,192,203);
        $this->RotatedText(35,190,'W a t e r m a r k   d e m o',45);
    }
    function RotatedText($x, $y, $txt, $angle){
        //Text rotated around its origin
        $this->Rotate($angle,$x,$y);
        $this->Text($x,$y,$txt);
        $this->Rotate(0);
    }
}
$pdf = new PDF();
$pages_count = $pdf->setSourceFile('teste.pdf'); 
$pdf->Output();
?>

CodePudding user response:

According to This resolved issue ... You need the FPDI Extension to extend the FPDF class. Installation can be found HERE

  • Related