Page Navigation
After loading a PDF document, you can programmatically interact with it, which allows you to view and transition between the pages like scrolling and jumping to specific pages.
// Previous page.
docViewer.previousPage();
// Next page.
docViewer.nextPage();
// Jump to a page.
docViewer.pageNumberChanged('3');
2
3
4
5
6
7
8
If you want to receive notifications when page numbers change, you can listen for the onPageNumberUpdated'
event.
Scroll
To scroll to specific distances in the horizontal and vertical directions, you can use the scrollTo
function.
// Top and left are optional.
docViewer.scrollTo({
top: 200,
left: 100
});
2
3
4
5
To scroll a certain percentage of distance horizontally or vertically, you can use the scrollToPercent
function.
// Top and left are optional.
docViewer.scrollToPercent({
top: 20,
left: 50
});
2
3
4
5
Scroll Mode
ComPDFKit for Web has two scrolling modes: Vertical and Horizontal. You can set the corresponding mode by using the following method.
docViewer.webViewerSwitchScrollMode(mode);
This is the parameters to apply different scroll modes.
Name | Required | Type | Description |
---|---|---|---|
mode | yes | number | Scroll Mode Parameter, Vertical: 0, Horizontal: 1 |
Thumbnails
Provide methods to render PDF pages as thumbnail images.