Document Viewing and Navigation Options
- 6 minutes to read
Once a document is loaded from a file or stream, the following operations become available both to end-users and programmatically:
Scrolling the document content and navigating between pages
Zooming the document view in or out
Rotating the document view
Searching a specific document text and navigating between the search results
Retracing the document viewing path by navigating between the saved view states
Printing the document
Scrolling and Document Navigation
The PDF Viewer control provides four document navigation options:
Continuous content scrolling available only as an end-user capability;
Discrete navigation between consecutive document pages available both to end-users and programmatically;
The capability to move selection between all found text matches within the document available via the Find panel and in code;
Navigation to bookmarked document sections by using the Navigation pane.
If the document does not fit into the control’s view area, an end-user can continuously scroll the content by:
Dragging the thumb of the vertical or horizontal scrollbar;
Clicking a vertical or horizontal scroll button to scroll the document view by a preset number of pixels in the respective direction;
Pressing the Left Right, Up, or Down key to scroll the document view by a preset number of pixels in the respective direction;
Rotating the mouse wheel up or down (only in the case of vertical scrolling). If an end-user rotates the mouse wheel up or down, the document view is scrolled up or down by a preset number of pixels, respectively;
Panning the document in any direction by dragging it with the Hand tool.
If the displayed document consists of more than a single page, the PDF Viewer provides the following discrete navigation options:
Navigating to… | Command | PDF Viewer’s Procedure | Keystroke |
---|---|---|---|
The next page. | GoToNextPage | GoToNextPage | The Down Arrow key. |
The previous page. | GoToPrevPage | GoToPrevPage | The Up Arrow key. |
The first page. | GoToFirstPage | GoToFirstPage | The Home key. |
The last page. | GoToLastPage | GoToLastPage | The End key. |
Zooming
The PDF Viewer provides the following zooming options:
Zooming to specific zoom factor values via the respective commands (10, 25, 50, 75, 100, 125, 150, 200, 400, and 500%);
Switch between available zoom factor calculation modes provided by the PDF Viewer’s OptionsZoom.ZoomMode property:
ZoomMode Property Value | Command | Zoom Mode Description | End-User Options |
---|---|---|---|
pzmPageWidth | ZoomFitWidth | The document is zoomed to fit the PDF Viewer’s current width. The zoom factor recalculateds every time the control’s width changes. | Click the “Zoom to Page Level” item in the PDF Viewer’s context menu. |
pzmPages | ZoomToPageLevel | The document is zoomed to fit a whole single page into the PDF Viewer. The zoom factor recalculates every time the control’s dimensions change. | Click the “Fit Width” item in the PDF Viewer’s context menu. |
pzmNone | Any other command that zooms the document view in or out. | Regardless of the PDF Viewer’s size, the specified zoom factor is used to display a document. | Click the “Zoom In”, “Zoom Out”, or “Actual Size” items in the PDF Viewer’s context menu, rotate the mouse wheel up or down while holding down the Ctrl key, or press the Ctrl+Plus Sign(+) or Ctrl+Minus Sign(-) key combination. |
- Zooming in and out by a fixed value:
Zoom… | Command | PDF Viewer’s Procedure | End-User Options |
---|---|---|---|
In by 10 percent. | ZoomIn | ZoomIn | Rotate the mouse wheel up one position while holding down the Ctrl key, click the “Zoom In” item in the PDF Viewer’s context menu, or pressing the Ctrl+Plus Sign(+) key combination. |
Out by 10 percent. | ZoomOut | ZoomOut | Rotate the mouse wheel down one position while holding down the Ctrl key, click the “Zoom Out” item in the PDF Viewer’s context menu, or pressing the Ctrl+Minus Sign(-) key combination. |
You can also specify the lower and upper limits of the PDF Viewer’s zooming range by using its OptionsZoom.MinZoomFactor and OptionsZoom.MaxZoomFactor properties, respectively.
Document View Rotation
The PDF Viewer provides the following document view rotation options:
Rotate the Document View… | Command | PDF Viewer’s Procedure | End-User Options |
---|---|---|---|
Clockwise by 90 degrees. |
RotateClockwise | RotateClockwise | Press the Ctrl+Shift+Plus Sign(+) key combination or click the Rotate Clockwise item in the PDF Viewer’s context menu. |
Counterclockwise by 90 degrees. |
RotateCounterclockwise | RotateCounterclockwise | The Ctrl+Shift+Minus Sign(-) key combination or click the Rotate Counterclockwise item in the PDF Viewer’s context menu. |
Text Searching
The PDF Viewer provides the capability to search a specific text within the loaded document either via the Find panel or by using the search-related API.
The Find panel provides the UI that allows users to search a text string, navigate between the found matches within the displayed document text and customize the search string interpretation settings (that is, enabling or disabling the case-sensitive and whole words search modes).
The PDF Viewer provides the following capabilities to show and hide the Find panel, provided that the control’s OptionsFindPanel.DisplayMode property is set to fpdmManual
:
Find Panel Operation | PDF Viewer’s Procedure | End-User Options | Command |
---|---|---|---|
Display | Press the F3 key or Ctrl+F key combination, or click the Find item in the PDF Viewer’s context menu. | ||
Hide | Press the Esc key or click the close button on the Find panel. |
For detailed information on working with the PDF document text search and highlight functionality, refer to the How to Search and Highlight Text in PDF Documents topic.
Navigating Between the View States
Every time the document view changes, it records the corresponding view state, allowing you to retrace the viewing steps. The PDF Viewer provides the following view state navigation options:
Navigate to… | Command | PDF Viewer’s Procedure | End-User Options |
---|---|---|---|
The next view state. | GoToNextView | GoToNextView | Press the Alt+Right Arrow key combination or click the Next View item in the PDF Viewer’s context menu. |
The previous view state. | GoToPrevView | GoToPrevView | Press the Alt+Left Arrow key combination or click the “Previous View” item in the PDF Viewer’s context menu. |
To clear the history of view states, call the PDF Viewer’s ClearViewStateHistory procedure.
Printing
Place the TdxComponentPrinter component on your application form and create a PDF Viewer report link within it at design time to enable the capability to print loaded PDF documents:
An end-user can press the Ctrl+P key combination or click the Print… item in the PDF Viewer’s context menu to display the Print dialog:
You can provide an additional end-user printing option by linking the ShowPrintForm command to an element of your UI or employ the automatic UI generation functionality provided by the PDF Viewer.
For detailed information on how to use the PDF Viewer’s document printing functionality, refer to the following topic: How to Print PDF Documents.
Note that the ShowPrintForm command, Ctrl+P key combination, and Print… item in the PDF Viewer’s context menu are unavailable if an encrypted PDF file is loaded with the user password and the document printing capability is restricted in the user mode. For information on other end-user capability restrictions in encrypted PDF documents, refer to the following topic: Password Protection.