PDF Viewer Toolbar Commands
- 2 minutes to read
The built-in PDF viewer toolbar allows you to show a search box, switch display modes, and invoke Thumbnail and Outline views. If the default toolbar does not meet your requirements, you can set the ShowToolbar to false
to hide it. To implement a custom toolbar, you can use the PDF viewer’s commands listed below:
Show, Share and Close Commands
- ShowOpenFileDialog
- Returns the command that invokes the file explorer to select a PDF file to open.
- 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.
Show Outlines and Thumbnails
- ToggleOutlines
- Returns the command that invokes the built-in Outlines page.
- ToggleThumbnails
- Returns the command that invokes the built-in Thumbnails page.
Zoom Commands
- ZoomIn
- Returns the command that zooms in the current document.
- ZoomOut
- Returns the command that zooms out of the current document.
Example
The following example implements a custom toolbar that allows users to invoke the system file explorer:
<Grid RowDefinitions="40,*">
<dxm:DXToolbar Grid.Row="0">
<dxm:ToolbarButton Icon="open" Command="{Binding Commands.ShowOpenFileDialog, Source={x:Reference pdfViewer}}"/>
</dxm:DXToolbar>
<dxpdf:PdfViewer x:Name="pdfViewer" Grid.Row="1" ShowToolbar="False"/>
</Grid>