New to Telerik UI for WinUI? Download free 30-day trial

Find

RadPdfViewer allows flexible searching in a loaded PDF document. The following article describes the available find methods, as well as how to use the respective for the feature API.

The searching can be done using the UI via the find dialog or programmatically.

Find Dialog

The find dialog is opened when you press Ctrl+F while the RadPdfViewer control is focused. Additionally, you can open the dialog by execuing the command of the ShowFindDialogCommandDescriptor.

Show find dialog

this.pdfViewer.CommandDescriptors.ShowFindDialogCommandDescriptor.Command.Execute(null); 

You can search by taking advantage of the Find, FindAll and FindPrevious methods of RadPdfViewer. The methods are provided with a string value representing the searched text and can accept additional search option via the TextSearchOptions class (an optional parameter of the methods).

The Find and FindPrevious methods are used the find the next and previous results. The return result is an object of type SearchResult.

Find method usage

SearchResult result = this.pdfViewer.Find("loading modes"); 
TextPosition start = result.Range.StartPosition; 
TextPosition end = result.Range.EndPosition; 
string foundText = result.Result; 
The FindAll method returns a collection of SearchResult objects.

FindAll method usage

IEnumerable<SearchResult> result = this.pdfViewer.FindAll("loading modes"); 
The additional overload of the find methods allows you to provide a TextSearchOptions containing additional search parameters.

TextSearchOptions usage

SearchResult result = this.pdfViewer.Find("loading modes", new TextSearchOptions(caseSensitive:true, useRegularExpression:true, wholeWordsOnly:true)); 

See Also

In this article
Not finding the help you need?