Skip to main content
.NET Framework 4.5.2+

PdfDocumentProcessor.FindText(String, PdfTextSearchParameters) Method

Searches for the specified text in the current document with the applied parameters.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v22.2.dll


public PdfTextSearchResults FindText(
    string text,
    PdfTextSearchParameters parameters


Name Type Description
text String

A String value, specifying the text to find in the PDF.

parameters PdfTextSearchParameters

A PdfTextSearchParameters object.


Type Description

A PdfTextSearchResults object.


The overloaded FindText method uses the page coordinate system. Refer to the Coordinate Systems topic for more information.

This example shows how to create a bookmark with a destination that displays the page as follows:


View Example

using System.Collections.Generic;
using DevExpress.Pdf;

using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor())
    // Load a document

    // Define search words
    string[] words = { "DX-B5000", "DX-RX800" };

    // Specify search parameters
    PdfTextSearchParameters searchParameters = new PdfTextSearchParameters();
    searchParameters.CaseSensitive = true;
    searchParameters.WholeWords = true;

    foreach (string word in words)
        // Get search results
        PdfTextSearchResults results = documentProcessor.FindText(word, searchParameters);

        // If the text is found, create a destination that positions the found text
        // at the upper window corner
        if (results.Status == PdfTextSearchStatus.Found)
            PdfXYZDestination destination = new PdfXYZDestination(results.Page, 0, results.Rectangles[0].Top, null);

            // Create a bookmark associated with the destination
            PdfBookmark bookmark = new PdfBookmark() { Title = word, Destination = destination };

            // Add the bookmark to the bookmark list
    // Save the modified document
See Also