# Searching

The PdfViewer allows for flexible searching in a loaded PDF document, which can be done either by using the UI through the **Find** dialog or programmatically.

## Searching through the UI

The following image shows the **Find** dialog of the PdfViewer.

![WinUI RadPdfViewer ](https://www.telerik.com/winui/documentation/assets/4b2aee6f68845d043b1415070fc67c30/radpdfviewer-find-0.png)

The **Find** dialog is opened when you press `Ctrl`+`F` while the PdfViewer is focused. Additionally, you can open the dialog by executing the command of the `ShowFindDialogCommandDescriptor`.

#### **Show the Find dialog**

```C#
this.pdfViewer.CommandDescriptors.ShowFindDialogCommandDescriptor.Command.Execute(null);
```

## Programmatic Search

You can search by using the `Find`, `FindAll`, and `FindPrevious` methods of the PdfViewer. The methods are provided with a `string` value representing the searched text and can accept additional search options through the `TextSearchOptions` class (an optional parameter of the methods).

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

#### **Use the Find method**

```C#
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.

#### **Use the FindAll method**

```C#
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.

#### **Use the TextSearchOptions**

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

## See Also

* [Saving Files](https://www.telerik.com/winui/documentation/controls/radpdfviewer/file-operations/save-as)
* [Keyboard Support](https://www.telerik.com/winui/documentation/controls/radpdfviewer/keyboard-support)
