PDF Viewer Toolbar Commands
- 3 minutes to read
The built-in PDF viewer toolbars allow you to show a search box, switch display modes, navigate between pages and edit the document. If the default toolbars do not meet your requirements, you can set ShowToolbar and ShowEditToolbar to false
to hide them. To implement a custom toolbar, you can use PDF viewer commands listed below:
Show, Share and Close Commands
- 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 Commands
- 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 Commands
- 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.
Print Command
- 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 Commands
- ZoomIn
- Returns the command that zooms in the current document.
- ZoomOut
- Returns the command that zooms out of the current document.
Selection Commands
- ClearSelection
- Returns the command that resets the selection.
- CopySelection
- Returns the command that copies the selected content to the clipboard.
Text Effect Commands
- 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.
Annotation Commands
- 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 invoke 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>