I am trying to use Pdfparser library to parse a PDF file but I have some issues with classes inclusion.
I read the documentation but it doesn't works.
I use Windows and XAMPP.
- I created a directory in
/xampp/htdocs/pdf_import
- I installed Composer and I've generated the
/vendor/autoload.php
inpdfparser-master/src
- I use the code example in documentation
Example:
<?php
require 'vendor/autoload.php';
// Parse pdf file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('document.pdf');
// Retrieve all pages from the pdf file.
$pages = $pdf->getPages();
// Loop over each page to extract text.
foreach ($pages as $page) {
echo $page->getText();
}
When I run the php script I obtain this error:
Fatal error: Class 'Smalot\PdfParser\Parser' not found in C:\xampp\htdocs\pdf_import\pdfparser-master\src\import.php on line 8