How to get images and text in order as in PDF?
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
- PDFParser Version: 2.9
Description:
I want to extract the PDF then save text to db and image to storage, but the order matters, if i take page 1, when i get an image, i need to get text coming after that.
PDF input
PDF containing some text then images in each pages,
Expected output & actual output
I need to extract the image and text in order as in the PDF
How to do That ?
Code
Code I'm using for extracting the image, but text is not available here
$parser = new Parser();
$pdf = $parser->parseFile(public_path('paper.pdf'));
$objects = $pdf->getObjects();
foreach ($objects as $key => $object) {
echo '<img src="data:image/jpg;base64,'. base64_encode($object->getContent()) .'" />';
}
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 with the Parser, parseFile(), getObjects(), and each object's getContent() call shown in the issue, using paper.pdf as the input. Determine whether the library exposes text and images in document order; done means extracting both while preserving their sequence on each page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100