# Saving Files

The PdfViewer enables you to save the loaded document on the file system by wiring this functionality to the UI  with the related command or through code execution.

To open a **Save file** dialog that allows you to choose a destination for the saved file on the file system, use the `SaveAsCommandDescriptor` and its command.

![WinUI RadPdfViewer ](https://www.telerik.com/winui/documentation/assets/e25372c5ea76d764607986d202d3067f/radpdfviewer-save-as-0.png)

#### **Execute the Save as command in code**

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

You can wire the `SaveAsCommandDescriptor` to the UI by using the following approach. The example shows how to bind the command of the `SaveAsCommandDescriptor` to the `Command` property of a `RadButton` control.

#### **Bind a command to a button in XAML**

```XAML
<telerik:RadButton Content="Save As" 
				Command="{Binding ElementName=pdfViewer, Path=CommandDescriptors.SaveAsCommandDescriptor.Command}"/>
```

To save the file silently without opening the **Save As** dialog, call the `Save` method of `RadPdfViewer`.

#### **Save a file by using the Save method**

```C#
this.pdfViewer.Save(new FileStream("C:\\temp\\Sample.pdf", FileMode.CreateNew));
```

## See Also

* [Getting Started with the Telerik UI for WinUI PdfViewer](https://www.telerik.com/winui/documentation/controls/radpdfviewer/getting-started)
* [Opening Files](https://www.telerik.com/winui/documentation/controls/radpdfviewer/file-operations/open-files)
