Back to Devexpress

Search Document Content

windowsforms-119960-controls-and-libraries-pdf-viewer-manipulate-document-content-search-for-a-specific-text.md

latest1.7 KB
Original Source

Search Document Content

  • Jul 21, 2021
  • 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, click the Find button on the toolbar or press Ctrl + F. This invokes the Find dialog.

To invoke the Find dialog from the context menu, right-click the document and select the Find item in the context menu.

To invoke the Find dialog in code, call the overloaded PdfViewer.ShowFindDialog method.

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.

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

To find text in a document programmatically, call the PdfViewer.FindText method. This method has 3 overloads, depending on your search criteria.

To change the default visibility behavior of the Find dialog, handle the PdfViewer.FindDialogVisibilityChanged event.