Skip to main content

Search Document Content

  • 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.

pdf-viewer-12

FindTextDialog

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

pdf-viewer-7

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.

    pdf-viewer-search

  • 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:

    TextSearchFinished

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.