3

I want to edit some pdf file with setasign fpdi, When it was fpdi still in version 1.6.* i use this way to use it : I install it via composer

composer require setasign/fpdf & composer require setasign/fpdi

And i use it in Laravel controller :

$pdf = new \FDPI();
$pdf->setSourceFile('PATH/TO/SOURCEFILE');
$pdf->Output();

It work for fpdi version 1.6.* (Legacy)

But when i use the fpdi v2.0.0 and i call the fpdi class in controller using

$pdf = new \FPDI();

it give an error message "Could find FPDI class" from Laravel

Any advice on how to use fpdi v2.0.0 in Laravel5?

Thank you in advance.

Fradia
  • 33
  • 2
  • 6

1 Answers1

7

Version 2 uses namespaces:

$pdf = new \setasign\Fpdi\Fpdi();

A full migration guide is available here.

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