PDF Viewer Toolbar Commands
- 3 minutes to read
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.
#Predefined PDF Viewer Toolbar Commands
The list below groups all commands available in default toolbars by functionality:
#Show, Share and Close
- ShowOpenFileDialog
- Returns the command that invokes the file explorer to select a PDF file to open.
- ShowSaveFileDialog
- Returns the command that invokes the system file picker dialog to save the current PDF document.
- ShareDocument
- Returns the command that invokes a share UI prompting the user to choose an app to share with.
- CloseDocument
- Returns the command that closes the document.
#Navigation
- GoToFirstPage
- Returns the command that navigates the document to the first page.
- GoToLastPage
- Returns the command that navigates the document to the last page.
- GoToNextPage
- Returns the command that navigates the document to the next page.
- GoToPreviousPage
- Returns the command that navigates the document to the previous page.
#Search
- SearchBackward
- Returns the command that searches the text string passed in parameters backward in the document starting from the previous page.
- SearchForward
- Returns the command that searches the text string passed in parameters forward in the document starting from the current page.
- PrintDocument
- Returns the command that invokes the system print dialog.
#Open Outlines, Thumbnails and Annotations Pages
- ToggleOutlines
- Returns the command that invokes the built-in Outlines page.
- ToggleThumbnails
- Returns the command that invokes the built-in Thumbnails page.
- ToggleAnnotations
- Returns the command that invokes the built-in Annotations page.
#Zoom
- ZoomIn
- Returns the command that zooms in the current document.
- ZoomOut
- Returns the command that zooms out of the current document.
#Selection
- ClearSelection
- Returns the command that resets the selection.
- CopySelection
- Returns the command that copies the selected content to the clipboard.
#Text Effects
- HighlightSelectedText
- Returns the command that highlights selected text with a filled rectangle.
- SquiggleSelectedText
- Returns the command that underlines selected text with a squiggle line.
- StrikethroughSelectedText
- Returns the command that applies strikethrough to selected text.
- UnderlineSelectedText
- Returns the command that underlines selected text with a straight line.
#Annotations
- DeleteSelectedAnnotation
- Returns the command that removes the selected annotation.
- SelectNextAnnotation
- Returns the command that selects the next annotation in the current document.
- SelectPreviousAnnotation
- Returns the command that selects the previous annotation in the current document.
- ToggleAnnotations
- Returns the command that invokes the built-in Annotations page.
#Example
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>