Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Search for a Specific Text

  • 2 minutes to read

The PDF Viewer allows you to search for a word (words) or any set of characters in a document.

To search for a specific text, do the following:

  • click the Find button on the toolbar or press Ctrl+F.

Find

This invokes the Find dialog.

FindDial

To invoke the Find dialog using the context menu, right-click the document and select the Find previewButtonSearch item in the context menu, or press Ctrl+F.

FindContextMenu

To invoke the Find dialog in code, execute the DocumentViewerControl.ShowFindTextCommand command in the PdfViewerControl.DocumentLoaded event.

  • In the Find dialog, type the text you want to search for and specify the following settings (if required):

    • the Case Sensitive option specifies whether to ignore the letter case when searching text;
    • the Whole Words Only option only considers whole words when searching text. For example, it does not find the word types when you search for type.

FindDialog

To start searching, click the Next button in the Find dialog, or press the ENTER key when the PDF Viewer shows the Find dialog.

The PDF Viewer stops searching when it finds the first occurrence of the search text, highlights the occurrence and navigates to the highlighted text.

Note

If a part of the word is searched, the PDF Viewer highlights whole words that contain the word part. For example, let’s take the following sentence: “The DevExpress PDF Viewer control displays PDF files directly in your application without the need to install an external PDF Viewer on your end user’s machine”. if you search for the word character p) (the Case Sensitive option is disabled) in this sentence, the words DevExpress, PDF, displays, PDF, application, and PDF are highlighted sequentially in the order these words appear in the sentence.

To search for the next match, click the Next button in the Find dialog, or press the ENTER key again when the PDF Viewer shows the Find dialog.

To go to the previous match, click the Previous button.

The PDF Viewer shows the following message when it finds the final occurrence of the search text or there were no results that match the search text:

Result

To find text in a document programmatically, call the PdfViewerControl.FindText method and pass search parameters represented by a TextSearchParameter object to this method.