smalot / smalot/pdfparser

Uncaught Error: Call to a member function getPages() on null

Open
#232 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

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

  1. Download this test PDF: http://www.orimi.com/pdf-test.pdf
  2. 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;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the linked pdf-test.pdf and the shown Parser::parseFile() followed by getPages() call. Start by tracing the returned value from parseFile() into getPages(); the issue does not identify a target behavior or acceptance criteria, so the expected handling must be clarified before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.