Edit this page

Find Dialog

RadPdfViewer allows flexible searching in a loaded PDF document. The following article describes the available search options, as well as how to use and customize the find dialog.

Other than the default needed assemblies, in order to take advantage of the Find dialog functionality in RadPdfViewer you need to add to your project a reference to Telerik.Windows.Controls.Navigation.dll.

Using the UI

There are three possible input parameters that determine the results of the search:

  1. Regular Expression: Finds and returns entry of specified regular expression.

  2. Case Sensitive: Finds and returns all entries of a specified string taking into consideration case-sensitive. For example, you are going to find “AB” string, strings such as “aB”, “Ab” and “ab” would be ignored in the results.

  3. Whole Words Only: Finds and returns all entries of a given string which should be a whole word only (not a part of a word).

This is how the Find Dialog looks:
Rad Pdf Viewer Find Dialog

Adding the FindDialog to a project

In a few simple steps the FindDialog could be added to a project.

First of all, it is obligatory to register a new find dialog using the ExtensibilityManager:

C#

    ExtensibilityManager.RegisterFindDialog(new FindDialog());

The ShowFindDialogCommand handles the opening of the find dialog. This command is bound to the Ctrl+F shortcut key combination (Apple+F for Mac) in RadPdfViewer.

Creating a custom find dialog

RadPdfViewer offers an easy way to create a custom find dialog which suits best to different user’s needs and desires.

In order to achieve this, should be created a class which inherits the IFindDialog interface with its ShowDialog method.

C#

    public class CustomFindDialog : Window, IFindDialog
    {
        public void ShowDialog(FindDialogContext context)
        {
            ...
        }
    }

Find a runnable project example demonstrating this functionality in our online SDK repository here, the example is listed as PdfViewer / CustomFindDialog.