Skip to main content

PdfViewerControl.FindText(TextSearchParameter) Method

Finds text within the current document based on the specified search parameters.

Namespace: DevExpress.Xpf.PdfViewer

Assembly: DevExpress.Xpf.PdfViewer.v23.1.dll

NuGet Package: DevExpress.Wpf.PdfViewer


public virtual PdfTextSearchResults FindText(
    TextSearchParameter parameter


Name Type Description
parameter TextSearchParameter

Specifies search parameters.


Type Description

Contains information related to search results.


Use the FindText method to perform a search in a PDF document. The TextSearchParameter.CurrentPage specifies the document page where the search starts. When you scroll the document and continue to search the same text again, the search continues from the currently visible page defined by the PDF Viewer’s CurrentPageNumber property. Use the ContinueSearchFrom property to control how to continue a search in the document: from the current page (the default option) or the last search result.

The FindText method stops the search when it finds the first occurrence of the search term, highlights the occurrence and navigates to the highlighted text.

When you change the search parameters (TextSearchParameter.Text, TextSearchParameter.WholeWord, or TextSearchParameter.IsCaseSensitive), the PDF Viewer starts a new search.


The FindText method uses the page coordinate system. See the Coordinate Systems topic to learn more.


View Example:

This example shows how to execute the Find Next action by pressing the F3 shortcut.

To do this, handle the PdfViewerControl.KeyDown event. If the F3 key is pressed, call the PdfViewerControl.FindText method and pass the search parameters represented by the TextSearchParameter object (e.g, search text, whole words, case sensitive).

using System.Windows;
using System.Windows.Input;
using DevExpress.Xpf.DocumentViewer;

namespace FindText {
    public partial class MainWindow : Window {
        public MainWindow() {

        private void viewer_KeyDown(object sender, KeyEventArgs e) {
            if (e.Key == Key.F3) {
                TextSearchParameter parameters = new TextSearchParameter {
                    IsCaseSensitive = true,
                    WholeWord = true,
                    Text = "Viewer"
See Also