Back to Devexpress

Adjust the Document View in PDF Viewer

windowsforms-401094-controls-and-libraries-pdf-viewer-adjust-the-document-view.md

latest6.4 KB
Original Source

Adjust the Document View in PDF Viewer

  • Oct 29, 2025
  • 4 minutes to read

Browse Document Pages

Use the PdfViewer.CurrentPageNumber property to change the current page, as shown below. The PdfViewer.PageCount property returns the total number of document pages.

csharp
pdfViewer.CurrentPageNumber = 5;
vb
pdfViewer.CurrentPageNumber = 5

The PdfViewer.CurrentPageChanged event occurs when an end user moves to another page. Handle this event to obtain the current page number and the total number of pages.

PDF Viewer ships with the following functionality to browse document pages.

  • Next and Previous buttons;

  • The Pager used to show the current page number and the total number of pages. Type a required page number and press ENTER to go to this page.

  • The Page Thumbnails panel on the Navigation pane. Click a page thumbnail to go to the required page.

Rotate a Document

Use the PdfViewer.RotationAngle property to rotate document pages. The RotationAngle property can have one of the following values: 0, 90, 180, 270. Otherwise, an ArgumentOutOfRangeException occurs.

The following code snippet rotates the loaded document counter-clockwise.

csharp
private void PdfViewer_DocumentChanged(object sender, PdfDocumentChangedEventArgs e)
{
    pdfViewer.RotationAngle = 270;
}
vb
Private Sub PdfViewer_DocumentChanged(ByVal sender As Object, ByVal e As PdfDocumentChangedEventArgs)
    pdfViewer.RotationAngle = 270
End Sub

Note

The PDF Viewer does not ship with API or User Interface features to rotate individual pages. Use PDF Document API instead.

The PDF Document API is a part of the Office File API or Universal subscription only, and is not included in the WinForms subscription. Please refer to the DevExpress Subscription page for pricing information.

Rotate a Document: Built-in UI Commands

End users can use Rotate Clockwise and Rotate Counterclockwise items from the context menu to rotate document pages. You can also use Ctrl + Shift + Add and Ctrl + Shift + Subtract shortcuts.

Zoom a Document

The following properties allow you to zoom in and out of a document.

APIDescription
PdfViewer.ZoomModeSpecifies the zoom mode. When the property is set to PdfZoomMode.Custom, the PdfViewer.ZoomFactor property defines the document zoom factor value.
PdfViewer.MinZoomFactorObtains minimum allowed zoom factor.
PdfViewer.MaxZoomFactorObtains maximum allowed zoom factor.

The following code snippet changes the zoom factor to 150 percent.

csharp
private void PdfViewer_DocumentChanged(object sender, PdfDocumentChangedEventArgs e)
{
    pdfViewer.ZoomMode = PdfZoomMode.Custom;
    pdfViewer.ZoomFactor = 150;
}
vb
Private Sub PdfViewer_DocumentChanged(ByVal sender As Object, ByVal e As PdfDocumentChangedEventArgs)
    pdfViewer.ZoomMode = PdfZoomMode.Custom
    pdfViewer.ZoomFactor = 150
End Sub

When the document’s zoom is changed, the PdfViewer.ZoomChanged event occurs. The event args allows you to obtain current zoom mode and zoom factor.

Zoom a Document: Built-in UI Commands

Use buttons on the Zoom ribbon group on the PDF Viewer tab to zoom a document.

You can press Ctrl + Plus and Ctrl + Minus , or hold Ctrl and rotate the mouse wheel to zoom a page.

Use Marquee Zoom Tool

The Marquee Zoom tool allows end users to zoom a particular part of the page.

Right-click the document and select the Marquee Zoom item in the context menu to activate the tool.

Set PdfViewer.CursorMode property to PdfCursorMode.MarqueeZoom to activate the marquee zoom in code.

Drag a rectangle around the page area to zoom in on it. Click the area to increase the zoom level. Click while pressing the Ctrl key to decrease the zoom level.

Previous and Next View

Execute the PdfPreviousViewCommand or PdfNextViewCommand command to switch between recently used page display styles (that is, previous zoom factor, rotation angle, and page display mode). If the page display options were not changed, the PDF Viewer shows the previously displayed page.

Previous and Next View in the User Interface

Previous View and Next View items allows you to navigate between recently used page display styles.

You can also use Alt+Left or Alt+Right shortcuts to go to previous views and pages. Note that the PDF Viewer shows these pages in reverse order.