Scrolling
PdfViewer has built-in scrolling mechanism.
The scrolling is available with the horizontal and vertical scrollbars of the control. You can scroll by dragging the scrollbars or by using the arrow keys of the keyboard, or by using the mouse wheel.
Programmatic Scrolling
RadPdfViewer
is exposing 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
—Tells if the document can be scrolled horizontally. This property has only a getter and it istrue
when the horizontal scrollbar is rendered. -
CanVerticallyScroll
—Tells if the document can be scrolled horizontally. This property has only a getter and it istrue
when the horizontal scrollbar is rendered. -
HorizontalScrollOffset
—Gets the current horizontal scroll offset. -
VerticalScrollOffset
—Gets the current vertical scroll offset.
To scroll manually, you can set the Value
property of the ScrollBar
elements. Or you can use the ScrollToHorizontalOffset
and ScrollToVerticalOffset
methods of RadPdfViewer
.
Scroll to horizontal offset
this.pdfViewer.ScrollToHorizontalOffset(50);
Scroll to vertical offset
this.pdfViewer.ScrollToVerticalOffset(50);
GoToDestination
method.
Scroll to destination
Destination destination = new Location() { Page = this.pdfViewer.Document.Pages[2], Left = 0, Top = 0, Zoom = 1 };
this.pdfViewer.GoToDestination(destination);