getDataTm returns empty array for one page only

Open
#717 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Start with the attached rearranged.pdf and reproduce the issue using Parser, parseFile(), getPages()[1], and getDataTm(). Compare the page that returns data with the page that returns an empty array, then verify that the affected page can be parsed without changing the expected output for the other pages.

Written by the indexing model from the issue text.

Description

bug
  • PHP Version: 8.3.1
  • PDFParser Version: 2.10
Description:

I have a muti page pdf (about 90 pages) . All pages contain table of similar data and all parse with getDataTm without issue except one, getDataTm returns an empty array on the problem page. I've attached two pages of the document, the second page is the one that one won't parse.

PDF input

rearranged.pdf

Expected output & actual output

result from page 1:

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [0] => 1
                    [1] => 0
                    [2] => 0.000000
                    [3] => -1
                    [4] => 377.119995
                    [5] => 33.279999
                )

            [1] => SNAPSHOT - MERLIN CAR AUCTIONS - JANUARY TO APRIL2024
        )

etc

result from page 2:
Array ()

Code
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('rearranged.pdf');

$data = $pdf->getPages()[1]->getDataTm();
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
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.

More from smalot/pdfparser

All issues in smalot/pdfparser

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.