smalot / smalot/pdfparser

Method getDataTm return empty array

Open
#571 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • PHP Version: 7.3
  • PDFParser Version: latest
Description:

Hi,

I'm using the latest version of smalot pdf parser, and trying to use getDataTm on the attached PDF, but always return an empty array.

PDF input
Expected output & actual output
Code
include('vendor/autoload.php');
$config = new Smalot\PdfParser\Config();
 
$config->setDataTmFontInfoHasToBeIncluded(true);

// use config and parse file
$parser = new Smalot\PdfParser\Parser([], $config);
$pdf = $parser->parseFile('test.pdf');
 
$data = $pdf->getPages()[0]->getDataTm();

var_dump($data);

test.pdf

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 vendor/autoload.php, the Parser and Config setup shown, and the attached test.pdf. Start at getDataTm() on the first parsed page and trace why it returns an empty array when setDataTmFontInfoHasToBeIncluded(true) is enabled. Done means the reported PDF produces the expected non-empty data.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.