SearchResult class

SearchResult class

Represents the search result in the search functionality.

An instance of SearchResult class is used as return value of Parser.search and Parser.search methods. See the usage examples there.

The SearchResult type exposes the following members:

Properties

Property Description
left_highlight_item The left highlight item.
page_index The page index where the text is found. Zero-based index of the page where the text is found; None if the search is performed on the whole document text.
position The position in the document text.
right_highlight_item The right highlight item.
text The text of the search result.

Example

from groupdocs.parser import Parser

with Parser("./sample.pdf") as parser:
    search_results = parser.search("lorem")
    if search_results is None:
        print("Search isn't supported")
    else:
        for result in search_results:
            print(f"At {result.position}: {result.text}")

See Also