Scrolling
The PdfViewer has a built-in scrolling mechanism.
Scrolling with the Scrollbars
You can scroll with the horizontal and vertical scrollbars of the control by dragging them, or by using the arrow keys of the keyboard or the mouse wheel.
Programmatic Scrolling
The PdfViewer exposes the following properties related to the scrolling functionality that can be used to access or modify the scrolling behavior and appearance:
-
HorizontalScrollBar
—Holds a reference to the horizontalScrollBar
control. You can use this property to access the scrollbar and update its value or change its appearance. -
VerticalScrollBar
—Holds a reference to the verticalScrollBar
control. You can use this property to access the scrollbar and update its value or change its appearance. -
CanHorizontallyScroll
—Indicates if the document can be scrolled horizontally. This property has only a getter and istrue
when the horizontal scrollbar is rendered. -
CanVerticallyScroll
—Indicates if the document can be scrolled vertically. This property has only a getter and istrue
when the vertical scrollbar is rendered. -
HorizontalScrollOffset
—Gets the current horizontal scroll offset. -
VerticalScrollOffset
—Gets the current vertical scroll offset.
To enable manual scrolling, set the Value
property of the ScrollBar
elements, or use the ScrollToHorizontalOffset
and ScrollToVerticalOffset
methods of the PdfViewer.
Scroll to the horizontal offset
this.pdfViewer.ScrollToHorizontalOffset(50);
Scroll to the vertical offset
this.pdfViewer.ScrollToVerticalOffset(50);
GoToDestination
method.
Scroll to a destination
Destination destination = new Location() { Page = this.pdfViewer.Document.Pages[2], Left = 0, Top = 0, Zoom = 1 };
this.pdfViewer.GoToDestination(destination);