Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf2json interprets one word as 2 JSON objects #71

Open
felixhaag opened this issue Jul 2, 2016 · 6 comments
Open

pdf2json interprets one word as 2 JSON objects #71

felixhaag opened this issue Jul 2, 2016 · 6 comments

Comments

@felixhaag
Copy link

felixhaag commented Jul 2, 2016

Hi,

I use pdf2json to parse some pdfs, which contain week-tables. However, after I parse the files, there’s a strange behavior - some of the words are separated in the JSON-file as different objects, while they’re actually one word inside of the pdf.

Example:
Files:
plan.pdf
plan.txt (sorry, can't upload JSON-Files)

The word:
„Champignons“ (column: „Mittwoch“, row: 2, line: 3) is interpreted as "Champig" and "nons" (2 JSON Objects)

JSON:
{"x":26.51,"y":16.388,"w":3.932,"sw":0.35678125,"clr":0,"A":"left","R":[{"T":"Champig","S":3,"TS":[0,12,0,0]}]},{"x":28.745,"y":16.388,"w":7.169,"sw":0.35678125,"clr":0,"A":"left","R":[{"T":"nons%20und%20Lauch%20","S":3,"TS":[0,12,0,0]}]}

This issue also occur in other rows. I suspect that it's caused by the specific pdf-structure.

Any ideas how I can fix that?

Thanks for your support!

@modesty
Copy link
Owner

modesty commented Jul 2, 2016

have you tried to parse with '-m' in cmd line?

@felixhaag
Copy link
Author

felixhaag commented Jul 3, 2016

Thanks for your reply!
Tried it with '-m' in command-line, but the words are still interpreted as separated JSON-objects

@modesty
Copy link
Owner

modesty commented Jul 3, 2016

could you remove Math.abs from line 197 of lib/pdf2json/pdffont.js, then run with -m again?

@felixhaag
Copy link
Author

After I removed the Math.abs function and ran it with the 'm' parameter, the strings in the columns next to each other were merged together. The affected words are still presented in separated JSON-objects.

@modesty
Copy link
Owner

modesty commented Jul 5, 2016

could you try it with v1.1.6?

@autoantwort
Copy link

autoantwort commented Apr 19, 2020

Hello, I don't think that this is a bug with pdf2json and the word Champignons is divided into two PDF objects in the PDF. So this is a "Bug" when the document was created. If you select the text with the chromium buildin PDF Viewer the word Champignons gets splitted into two words too.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants