Your online demo behave different than library on the same file
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
I tried to upload a PDF of a customer order where each row details is complex because some data are on multiple text rows, and each row has a lot of columns with different details.
Your online demo is great. Every order row is parsed one column at once, so inside each 'cell' of text, all words are keep together even if spanned on multiple text rows. Great, really !
I am using your library on php 7.2 in this way
public function filePdfUploaded(Request $request)
{
$pdf_file = $request->file('pdf');
$original_file_name = $pdf_file->getClientOriginalName();
$pdf_path = storage_path('app/'). $pdf_file->storeAs('pdf', $original_file_name);
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile($pdf_path);
$pages = $pdf->getPages();
// Loop over each page to extract text.
foreach ($pages as $page) {
echo "<HR /><PRE>" . $page->getText() . "</PRE>";
}
}
But the result is that it outputs the parsed text one entire column at time, so Insetead of
order number - quantity - detail --
order number - quantity - detail --
order number - quantity - detail --
order number - quantity - detail --
I got
order number
order number
order number
order number
quantity
quantity
quantity
quantity
detail
detail
detail
detail
Is there any options to set to have parsed text ordered as in your online demo?
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
Reproduce the discrepancy from the shown Parser()->parseFile() and page->getText() entry points using the referenced order PDF, comparing library output with the online demo. Trace how page text is ordered and determine whether an option can produce row-wise ordering; done means matching demo output or documenting that the behavior is unsupported.
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
- Mostly clear
- Newbie friendliness
- 35/100