HighlightItem class
Leave feedback
On this page
Represents a highlight, a part of the text which is usually used to explain the context of the found text in the search functionality.
An instance of HighlightItem is used as the return value of Parser.get_highlight (int, bool, HighlightOptions) method, and of the SearchResult.left_highlight_item and SearchResult.right_highlight_item properties. See the usage examples there.
The HighlightItem type exposes the following members:
| Property | Description |
|---|---|
| position | The zero-based index of the start position of the highlight in the document text. |
| text | The text of the highlight. |
from groupdocs.parser import Parser
from groupdocs.parser.options import HighlightOptions
with Parser("./sample.pdf") as parser:
options = HighlightOptions(20) # extract 20 characters around the highlight
highlight = parser.get_highlight(100, True, options)
if highlight is not None:
print(f"Position: {highlight.position}")
print(f"Text: {highlight.text}")
- module
groupdocs.parser.data
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.