maui-404715-pdf-viewer-commands.md
Built-in PDF viewer toolbars allow you to display a search box, switch display modes, navigate between pages, and edit the document. If predefined toolbars do not meet your requirements, you can set ShowToolbar and ShowEditToolbar properties to false to hide the toolbars. You can also create a custom toolbar and populate it with PDF viewer commands as demonstrated in the code example below.
Tip
You can see the full list of available commands on the following page: PDF viewer commands.
The list below groups all commands available in default toolbars by functionality:
ShowOpenFileDialogReturns the command that invokes the file explorer to select a PDF file to open.ShowSaveFileDialogReturns the command that invokes the system file picker dialog to save the current PDF document.ShareDocumentReturns the command that invokes a share UI prompting the user to choose an app to share with.CloseDocumentReturns the command that closes the document.
GoToFirstPageReturns the command that navigates the document to the first page.GoToLastPageReturns the command that navigates the document to the last page.GoToNextPageReturns the command that navigates the document to the next page.GoToPreviousPageReturns the command that navigates the document to the previous page.
SearchBackwardReturns the command that searches the text string passed in parameters backward in the document starting from the previous page.SearchForwardReturns the command that searches the text string passed in parameters forward in the document starting from the current page.
PrintDocumentReturns the command that invokes the system print dialog.
ToggleOutlinesReturns the command that invokes the built-in Outlines page.ToggleThumbnailsReturns the command that invokes the built-in Thumbnails page.ToggleAnnotationsReturns the command that invokes the built-in Annotations page.
ZoomInReturns the command that zooms in the current document.ZoomOutReturns the command that zooms out of the current document.
ClearSelectionReturns the command that resets the selection.CopySelectionReturns the command that copies the selected content to the clipboard.
HighlightSelectedTextReturns the command that highlights selected text with a filled rectangle.SquiggleSelectedTextReturns the command that underlines selected text with a squiggle line.StrikethroughSelectedTextReturns the command that applies strikethrough to selected text.UnderlineSelectedTextReturns the command that underlines selected text with a straight line.
DeleteSelectedAnnotationReturns the command that removes the selected annotation.SelectNextAnnotationReturns the command that selects the next annotation in the current document.SelectPreviousAnnotationReturns the command that selects the previous annotation in the current document.ToggleAnnotationsReturns the command that invokes the built-in Annotations page.
The following example implements a custom toolbar that allows users to open the system file explorer:
<Grid RowDefinitions="40,*">
<dx:DXToolbar Grid.Row="0">
<dx:ToolbarButton Icon="open" Command="{Binding Commands.ShowOpenFileDialog, Source={x:Reference pdfViewer}}"/>
</dx:DXToolbar>
<dx:PdfViewer x:Name="pdfViewer" Grid.Row="1" ShowToolbar="False"/>
</Grid>