Possible startxrefPreg extension
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Some PDFs in a project could not be read by the parser.
After a closer examination of the binary data, it was noticed that there is often a space before the reference byte.
After a brief search on the Internet, I could not find any information as to whether this space may be included or not. Perhaps someone here who is more familiar with the subject knows more.
By inserting an optional space in the RegEx at this point, the PDF is recognized again.
RegEx would then look like the following:
'/(?<=[\r\n])startxref[\s]*[\r\n]+[\s]*([0-9]+)[\s]*[\r\n]+%%EOF/i'
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 in src/Smalot/PdfParser/RawData/RawDataParser.php around lines 884-891 and inspect the startxref regular expression. Check how the parser handles a space before the reference byte, then verify that PDFs with this spacing are recognized without breaking existing inputs. No specific test file or fixture is mentioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100