Skip to content

Page Navigation plugin

The page-navigation plugin provides a few components to navigate between pages.

Install

> npm install '@sse-ui/pdf-page-navigation';

OR

> yarn add '@sse-ui/pdf-page-navigation';

The page-navigation plugin is included in the toolbar and default-layout plugins

Usage

1. Import the plugin

javascript
import { pageNavigationPlugin } from "@sse-ui/pdf-page-navigation";

// Import styles
import "@sse-ui/pdf-page-navigation/lib/styles/index.css";

2. Create the plugin instance

javascript
const pageNavigationPluginInstance = pageNavigationPlugin();

The pageNavigationPlugin() function takes an optional PageNavigationPluginProps parameter that consists of the following property: (? denotes an optional property)

PROPERTYTYPEDESCRIPTIONFROM
enableShortcuts?booleanEnable shortcuts1.0.0

The shortcuts are enabled by default. Users can use particular shortcuts to jump to the previous or next page:

SHORTCUTACTION
Command + ArrowLeft (on macOS)Go to the previous clicked link annotation
Alt + ArrowLeft (on Windows)Go to the previous clicked link annotation
PageUp or Alt + ArrowUpGo to the previous page
PageDown or Alt + ArrowDownGo to the next page

The plugin instance pageNavigationPluginInstance provides the following properties:

PROPERTYTYPEDESCRIPTIONFROM
CurrentPageInputReactElementAllow to jump to any page1.0.0
CurrentPageLabelReactElementDisplay the current page number1.0.0
GoToFirstPageReactElementCustomizable button to jump to the first page1.0.0
GoToFirstPageButtonReactElementThe button to jump to the first page1.0.0
GoToFirstPageMenuItemReactElementThe menu item to jump to the first page1.0.0
GoToLastPageReactElementCustomizable button to jump to the last page1.0.0
GoToLastPageButtonReactElementThe button to jump to the last page1.0.0
GoToLastPageMenuItemReactElementThe menu item to jump to the last page1.0.0
GoToNextPageReactElementCustomizable button to jump to the next page1.0.0
GoToNextPageButtonReactElementThe button to jump to the next page1.0.0
GoToNextPageMenuItemReactElementThe menu item to jump to the next page1.0.0
GoToPreviousPageReactElementCustomizable button to jump to the previous page1.0.0
GoToPreviousPageButtonReactElementThe button to jump to the previous page1.0.0
GoToPreviousPageMenuItemReactElementThe menu item to jump to the previous page1.0.0
NumberOfPagesReactElementDisplay the total number of pages1.0.0
jumpToNextPageFunctionJump to the next page1.0.0
jumpToPageFunctionJump to given page1.0.0
jumpToPreviousPageFunctionJump to the previous page1.0.0

See their usages in the examples below.

3. Register the plugin

Register the page-navigation plugin instance:

javascript
<Viewer plugins={[pageNavigationPluginInstance]} />

Properties

The page-navigation plugin provides other useful properties as following:

javascript
import {
  DownArrowIcon,
  NextIcon,
  PreviousIcon,
  UpArrowIcon,
} from "@sse-ui/pdf-page-navigation";
PROPERTYTYPEDESCRIPTIONFROM
DownArrowIconReactElementCan be used with going to the first page component2.0.0
NextIconReactElementCan be used with going to the next page component2.0.0
PreviousIconReactElementCan be used with going to the previous page component2.0.0
UpArrowIconReactElementCan be used with going to the last page component2.0.0

Released under the MIT License.