Skip to content

Parsing form object that is referenced by Do command #802

Description

@DominikDostal
  • PHP Version: 8.1.24
  • PDFParser Version: 2.12.5

Description:

User of the website im working on apparently used the website https://online2pdf.com to convert a word document into a pdf.
This website seems to generate PDFs in a weird way:
Instead of just putting the text into the page object as content it generated a form object containing the text and referenced this object in the page content with the Do command.

Currently PDFParser doesnt support the Do command and also can't correctly extract content (DataTm) from form objects.

PDF input

Test.pdf

Expected output & actual output

Expected:
Array containing the text Test and the coordinates of this textarea

Actual:

array (size=0)
  empty

Code

$filepath = "C:/Users/dd/Desktop/Test.pdf";
$filecontent = file_get_contents($filepath);
$config = new Config();
$config->setDataTmFontInfoHasToBeIncluded(true);
$parser = new Parser([], $config);
$pdf = $parser->parseContent($filecontent);
$pages = $pdf->getPages();
foreach ($pages as $page) {
    var_dump($page->getDataTm());
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions