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

Duplicating numbers and problem with whitespaces #464

Closed
ScreamDev1 opened this issue Oct 6, 2021 · 1 comment · Fixed by #634
Closed

Duplicating numbers and problem with whitespaces #464

ScreamDev1 opened this issue Oct 6, 2021 · 1 comment · Fixed by #634
Labels
bug missing or incomplete functionality For something which is not a bug, but more like an incomplete feature.

Comments

@ScreamDev1
Copy link

Hi, i have some issues with parsing pdf in Russia. First of all it's some problem with witespaces and also for some values of numeric i can see dupicates in parsed text. Attaching pdf and some screenshots, Thanks
Screenshot 2021-10-06 at 03-36-46 Demo PDF Parser
obj39453_pd32-000296.pdf

@k00ni k00ni added bug missing or incomplete functionality For something which is not a bug, but more like an incomplete feature. labels Oct 6, 2021
@GreyWyvern
Copy link
Contributor

GreyWyvern commented Aug 9, 2023

I believe the "duplicate" numbers here are because the document is overprinting them to make the bold. Perhaps because it doesn't have a bold font? Regardless, the duplicated numbers and text all show up bold in the PDF. Copy-pasting from Adobe only copies one of them though so it's smart enough to do that?

Here's one of the "duplicated" sections:

BT
/F7 12 Tf
1 0 0 -1 0 0 Tm
456 -584 Td
<002D> Tj
8 0 Td
<0048> Tj
8 0 Td
<0046> Tj
8 0 Td
<0003> Tj
1 0 0 -1 0 0 Tm
/Span << /ActualText <> >> BDC
455.500000 -584 Td
<002D> Tj
8 0 Td
<0048> Tj
8 0 Td
<0046> Tj
8 0 Td
<0003> Tj
EMC
ET

First it sets the text matrix to 1 0 0 -1 0 0 then positions it at 456 -584 and prints four characters. Then it resets the text matrix to 1 0 0 -1 0 0 and positions it almost on top of the previous start position, just a fraction to the right (or left?) at 455.500000 -584 to make the characters fatter and thus bolder. Then it prints the same four characters. Overprinting.

Edit: Looking at the code I posted again, it seems like Adobe is honouring the BDC ... EMC block and using the contents of /ActualText <> as the text to be copied. We should probably look to have PdfParser honour these blocks too in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug missing or incomplete functionality For something which is not a bug, but more like an incomplete feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants