Uncaught Error: Class 'PDFMerger' not found in

0

I am trying to use this library to join several PDFs PDFMerger

I have downloaded and added everything to my project, but nevertheless it throws me the error: "Fatal error: Uncaught Error: Class 'PDFMerger' not found in ... on line 32"

Here I add the file:

require'PDFMerger.php';

And here is when I use it:

$pdf = new PDFMerger;
foreach($ficheros as $fichero){
 $pdf->addPDF($fichero, 'all');
}
$pdf->merge('browser','result.pdf'); 

The file "PDFMerger.php" is in the same folder from where I call it

    
asked by Daniel Valencia Hernandez 29.10.2018 в 17:15
source

1 answer

0

the error is given because as you commented you are in the same folder! and you're trying to call a PDFMerger class;

you can do one of these 2 options

$pdf = new PDFMerger\PDFMerger;

or comment line 35

namespace PDFMerger;

and there are if you can do

$pdf = PDFMerger;
    
answered by 29.10.2018 / 17:43
source