ParserSearch Method (String)
Searches a keyword in the document.

Namespace: GroupDocs.Parser
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public IEnumerable<SearchResult> Search(
	string keyword
)

Parameters

keyword
Type: SystemString
The keyword to search.

Return Value

Type: IEnumerableSearchResult
A collection of SearchResult objects; null if search isn't supported.
Remarks
Examples

The following example shows how to find a keyword in a document:

C#
// Create an instance of Parser class
using(Parser parser = new Parser(filePath))
{
    // Search a keyword:
    IEnumerable<SearchResult> sr = parser.Search("page number");
    // Check if search is supported
    if(sr == null)
    {
        Console.WriteLine("Search isn't supported");
        return;
    }

    // Iterate over search results
    foreach(SearchResult s in sr)
    {
        // Print an index and found text:
        Console.WriteLine(string.Format("At {0}: {1}", s.Position, s.Text));
    }
}
See Also