smalot / smalot/pdfparser

Incorrect coordinates in footer

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

Nobody has claimed this yet.

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

Description

Hello

This is more of a discussion than an issue, but just to check if i'm doing something wrong. I'm generating a PDF using MPDF and trying to get coordinates for text in the footer. For some reason specifically the footer elements return invalid coordinates. For the footer element it's returning a negative value for the coordinates, as if it's outside the page.

I'm wondering if I'm passing insufficient amount of data or something to the main method or if you have any other advice.

Here's the code snippet

        $parser = new \Smalot\PdfParser\Parser();
        $pdf = $parser->parseContent($content);
        $pages = $pdf->getPages();

        foreach ($pages as $pageNumber => $page) {
            foreach ($page->getDataTm() as $item) {
                        # getting a negative value for some of the footer items
                }
        }

Thank you

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

Start with the provided Parser->parseContent(), getPages(), and page->getDataTm() call chain, then reproduce the reported negative footer coordinates using a representative PDF. The issue provides no PDF, source file, or test; done would require determining whether the coordinates are incorrect and documenting a reproducible correction or expected behavior.

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.