Problems to extract text from a PDF/A file
Open
Nobody has claimed this yet.
missing or incomplete functionality
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
For machine learning purposes (php-ml), I need to extract the raw text from lots of PDF files.
But unfortunately, for few of them, I was unable to get the text because they are using "stream" on their pdf source, like this one.
<?php
include 'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
// Parse pdf file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('pdfa.pdf');
$text = $pdf->getText();
echo $text;
The result is something like this:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with the linked PDF/A file and the shown Parser::parseFile() and getText() calls. Inspect how the parser handles PDF streams and compare the extracted result with the source document. Done means the reported PDF/A file yields its raw text without breaking existing parsing 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