pdfparser
pdfparser copied to clipboard
Uncaught Error: Call to a member function getPages() on null
A lot of PDFs (not all...) gives an Error (PHP 7, PHP 7.2 + 7.3)
Uncaught Error: Call to a member function getPages() on null
- Download this test PDF: http://www.orimi.com/pdf-test.pdf
- save to disk
3 run:
$parser = new \Smalot\PdfParser\Parser();
try {
$pdf = $parser->parseFile($file);
} catch(Exception $e) {
}
// echo '<pre>';
// print_r($pdf);
// exit;
// Retrieve all pages from the pdf file.
**$pages = $pdf->getPages();** >>> ERROR
$pageNr = 1;
I saved your PDF here, just in case. pdf-test.pdf
As you might already figured, it couldn't parse the file and returns null instead of an object to work with. Unfortunately I can't help you with that.
PdfParser now returns a "Secured PDF" exception for this document.
Fatal error: Uncaught Exception: Secured pdf file are currently not supported. in
/***/pdfparser/src/Smalot/PdfParser/Parser.php:105
So does that resolve this issue, or... ?
@chris087 is it a secured PDF?