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

Detecting underlined text #525

Open
lluchez opened this issue Nov 3, 2023 · 2 comments
Open

Detecting underlined text #525

lluchez opened this issue Nov 3, 2023 · 2 comments

Comments

@lluchez
Copy link

lluchez commented Nov 3, 2023

Hi,
Thank you so much for creating this awesome gem.

I'm having troubles figuring out a way to detect underlined text. Underlined texts have a different meaning the documents that I'm trying to parse and so I need to be able to detect if a text is underlined.

I've been looking at the PageTextReceiver and the method internal_show_text but I'm seeing anything that will tell me if a character is underlined or not.

I'm gonna continue digging into the library but if anyone has any pointers to share, I would greatly appreciate!

Thank you so much for any help!

Best,
Lio

@yob
Copy link
Owner

yob commented Nov 5, 2023

I'm not super familiar with underlining.

I suspect there's two common approaches

  1. drawing a line using line/stroke primitives rather than a text command
  2. using annotations

(1) will be hard to detect.

You might have some success with annotations. Annotations are stored in each page outside the content stream. This comment might help you poke around: #179 (comment)

@lluchez
Copy link
Author

lluchez commented Nov 6, 2023

Thank you @yob for your comment.

Unfortunately, I had already tried to parse annotations but nothing is coming back 😞.
I'm not too sure how the first option will work.

My original thought was to look at fonts (which we can get access to), but underlines are actually styles, not fonts. I might need to educate myself with the PDF format and how streams/objects are stored/formatted.

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

2 participants