Document Solutions for PDF
Document Solutions PDF Viewer Overview / View PDF / Features / Advanced Search Options
In This Topic
    Advanced Search Options
    In This Topic

    DsPdfViewer provides advanced search options to help you find the desired content in a PDF document. It eliminates the irrelevant options and narrows down the scope of a search query. Along with the count of total search results, it displays the page number on which the specific result is found.

    Advanced search options in GcDocs PDF Viewer

    The search results are highlighted all at once when 'Highlight all' option is checked in the search panel. The below code example shows how to change the default highlight colors by using the 'useCanvasForSelection' option:

    Index.cshtml
    Copy Code
    var viewer = new GcPdfViewer('#root',
        {
            useCanvasForSelection:
            {
                selectionColor: 'rgba(0, 0, 195, 0.25)',
                highlightColor: 'rgba(255, 0, 0, 0.35)',
                inactiveHighlightColor: "rgba(180, 0, 170, 0.35)"
            }
        });
    

    Various advanced search options are provided in DsPdfViewer which are explained as below:

    Match Case

    This option finds all those instances in a PDF document that are written in the same case (lower or upper) as specified in the search query.

    Example: If you search "test", the search results displays "test", "tests", "testing" but not "Test".

    Whole Word

    The 'Whole Word' option finds all those occurrences in a PDF document which contain the whole word as specified in the search query.

    Example: If you search "demo", the search results displays "demo", "Demo" but not "demonstration", "demos".

    Starts With

    This option finds all the occurences in a PDF document which starts with the characters specified in the search query.

    Example: If you search "us", the search results display "us", "used", "Users" but not "various", "status".

    Ends With

    This option finds all the occurences in a PDF document which ends with the characters specified in the search query.

    Example: If you search "at", the search results display "at", "format", "treat" but not "attribute", "atom".

    Wildcards

    The 'Wildcard' option can be used to maximize the search results. You can type a part of a word and use any number of wildcard characters with it. DsPdfViewer supports two wildcard characters:

    Note: Wildcard search option cannot be combined with 'Starts With', 'Ends With' and 'Whole Word' options.

    Proximity

    The 'Proximity' option can be used to search for two or more words that are separated by a certain number of words from each other. The operator AROUND(n) can be used to specify the maximum count of words between search terms. The search results includes only those words which are present on the same page of a PDF document.

    Example: Consider the below text in a PDF document:

    Several species of game fish live or spawn in wetlands. Hundreds, if not thousands, of invertebrates that form the food of birds also rely on water for most, if not all, phases of their existence. In fact, most all species of animals we have must spend at least part of the year in wetlands. To lose any more of these vital areas is almost unthinkable.

    Case 1:

    Search Query: species AROUND(8) wetlands

    Result: species of game fish live or spawn in wetlands

    Explanation: The words “species” and “wetlands” are present at a gap of 7 words from each other. In order to display this search result, the value of 'n' should be 7 or greater.


    Case 2:

    Search Query: species wetlands

    Results: species of game fish live or spawn in wetlands 

                 species of animals we have must spend at least part of the year in wetlands

    Explanation: If operator AROUND(n) is not specified, the search results will include all words from query without any location constraint.


    Case 3:

    Search Query: species AROUND(8) wetlands AROUND(4) thousands

    Result: species of game fish live or spawn in wetlands. Hundreds, if not thousands

    Explanation: The words “species”, “wetlands” and "thousands" are present at the specified gaps.

    Note: Proximity search option cannot be combined with 'Starts With', 'Ends With' and 'Wildcard' options.