0

everyone I am working with fpdf an fpdi, is my first work and I have a problem. I can not edit a pdf. This is the problem. thanks

Class setasign\Fpdi\FpdfTpl not found in C:\wamp\www\Ale\fpdi\src\Fpdi.php

    use setasign\Fpdi\Fpdi;

require_once('fpdf/fpdf.php');
require_once('fpdi/src/Fpdi.php');
require_once('fpdi/src/autoload.php');

// initiate FPDI
$pdf = new Fpdi();
// add a page
$pdf->AddPage();
// set the source file
$pdf->setSourceFile('documento.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at position 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 10, 10, 100);

// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');

$pdf->Output('newDoc.pdf','F');
Ilario Pierbattista
  • 3,175
  • 2
  • 31
  • 41

2 Answers2

0

You cannot edit a PDF with FPDI!

Remove the line:

require_once('fpdi/src/Fpdi.php');

...to give the later required autoload function a chance.

Jan Slabon
  • 4,736
  • 2
  • 14
  • 29
0

Maybe not related to this exact question but I had a similar situation in my Lumen project... I resolved it by reintsalling vendor files. I hope if someone is facing similar situation, I hope this helps.

Sreekuttan
  • 83
  • 1
  • 1
  • 5