I know this question has been asked many times but I read all related answer and my problem is not solved yet. I can add text and image on a new blank pdf file by code below.
<?Php
require('fpdf.php');
$pdf = new FPDF('P','mm','A4');
$pdf->AddPage();
/* $pdf->setSourceFile("test1.pdf"); */
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(0, 5);
$pdf->Write(0, 'This is just a simple text');
$pdf->Image('sample.png',100,0);
$pdf->Output('file.pdf','F');
?>
But when I uncomment the line /* $pdf->setSourceFile("sourse.pdf"); */
to add text and image on existing pdf, I get Uncaught Error: Call to undefined method FPDF::setSourceFile() .
Also when add
require('fpdi.php');
$pdf = new FPDI('P','mm','A4');
I get Uncaught Error: Class "setasign\Fpdi\FpdfTpl" not found . How can I solve this?