GroupDocs.Parser for .NET 19.11 Release Notes

Major Features

There are the following features in this release:

  • Implement the ability to extract a page number with search results

Full List of Issues Covering all Changes in this Release

KeySummaryIssue Type
PARSERNET-1294Implement the ability to extract a page number with search resultsNew feature

Public API and Backward Incompatible Changes

  1. Implement the ability to extract a page number with search results

    Description

    This feature allows to extract a page number with search results.

    Public API changes

    • Added **PageIndex **property to GroupDocs.Parser.Data.SearchResult class
    • Added **SearchByPages **property to GroupDocs.Parser.Options.SearchOptions class
    • Added (matchCase, matchWholeWord, useRegularExpression, findInPages, leftHighlightOptions, rightHighlightOptions) and (matchCase, matchWholeWord, useRegularExpression, findInPages) constructors to** GroupDocs.Parser.Options.SearchOptions** class

    Usage

    The following example shows how to search a text with page numbers:

    // Create an instance of Parser class
    using(Parser parser = new Parser(Constants.SamplePdf))
    {
        // Search a keyword with page numbers
        IEnumerable<SearchResult> sr = parser.Search("lorem", new SearchOptions(false, false, false, true));
        // 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, page number and found text:
            Console.WriteLine(string.Format("At {0} (page {1}): {2}", s.Position, s.PageIndex, s.Text));
        }
    }