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

How to highlight multiple lines of text #98

Closed
vikramsoni2 opened this issue Feb 29, 2024 · 8 comments · Fixed by #106
Closed

How to highlight multiple lines of text #98

vikramsoni2 opened this issue Feb 29, 2024 · 8 comments · Fixed by #106
Assignees
Labels
bug Something isn't working

Comments

@vikramsoni2
Copy link

If I want to highlight a paragraph of text, how do I do it? I see that the text-layer is generating spans of text for each lines. is there an easier way to pass a sentence in the highlight-text param so that it highlights the entire sentence ?

awesome work by the way!

@vikramsoni2 vikramsoni2 added the bug Something isn't working label Feb 29, 2024
@vikramsoni2
Copy link
Author

the highlighting of text is very unstable. if there is one italic or bold text in the line, that line does not highlight.

@fredrikmikkelsen
Copy link

fredrikmikkelsen commented Mar 22, 2024

I would like to second this. It would be a great addition if you could it make this possible.

Will it be made possible to add more than one highlighted sentence per page at some point?

Btw good job creating this package!

@TaTo30
Copy link
Owner

TaTo30 commented Mar 26, 2024

I would like to know your use cases.

The highlight-text prop is more like a "search and highlight the results" similar to ctrl + f feature on browsers.

@fredrikmikkelsen
Copy link

I would like to use the current functionality but to highligt multiple sentences on a page.

Lets say I have a page where both of these sentences are included: Lorem ipsum dolorand Aenean bibendum faucibus. Right now it's only possible to highlight one of them. I would like to be able to highlight both of them.

@vikramsoni2
Copy link
Author

I would like to know your use cases.

The highlight-text prop is more like a "search and highlight the results" similar to ctrl + f feature on browsers.

I did some experiments, it works as long as the text layer does not have any decoration ( i.e. bold or any other styles). when you have a pdf which has any styles, it cannot select those elements. It can select multiple lines of text if the texts are just plain-text. but if there is any other decoration, I see that the text layer creates spans to adjust the style, and that's where the highlighting breaks.

The use-case: I have Chat-bot which answers the questions from the PDF, and also provide the chunk of the pdf which was used to answer the question. ( the chunk is just text, not formatted text(. and I want to highlight the chunk.

@TaTo30
Copy link
Owner

TaTo30 commented Mar 28, 2024

I did some experiments, it works as long as the text layer does not have any decoration ( i.e. bold or any other styles). when you have a pdf which has any styles, it cannot select those elements. It can select multiple lines of text if the texts are just plain-text

Could you share the pdf of this issue? @vikramsoni2

@vikramsoni2
Copy link
Author

vikramsoni2 commented Apr 2, 2024

I did some experiments, it works as long as the text layer does not have any decoration ( i.e. bold or any other styles). when you have a pdf which has any styles, it cannot select those elements. It can select multiple lines of text if the texts are just plain-text

Could you share the pdf of this issue? @vikramsoni2

here you go. just created a small app for demo purpose. if you notice, I am trying to highlight the same paragraph in both pages. the first one includes a small decoration in the text which breaks the highlight. in the second page, I remove the last ward to not include that decorated text and it works.

https://stackblitz.com/edit/vitejs-vite-xcgtmn?file=src%2FApp.vue

@chronicadventure
Copy link

Any updates on this? this would be a great feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants