Skip to content

Scroll Mode plugin

The scroll-mode plugin provides buttons to adjust the scroll mode to one of four possible modes:

MODETYPEDESCRIPTION
ScrollMode.VerticalScrollModeThe default scroll mode. Scroll the pages in the vertical direction
ScrollMode.HorizontalScrollModeScroll the pages in the horizontal direction
ScrollMode.PageScrollModeDisplay a single page each time
ScrollMode.WrappedScrollModeScroll the pages in both vertical and horizontal directions

ScrollMode is an enum provided by the @sse-ui/pdf-core package.

Install

> npm install @sse-ui/pdf-scroll-mode;

OR

> yarn add @sse-ui/pdf-scroll-mode;

The scroll-mode plugin is included in the toolbar and default-layout plugins

Usage

1. Import the plugin

javascript
const scrollModePluginInstance = scrollModePlugin();

The plugin instance scrollModePluginInstance provides the following properties:

PROPERTYTYPEDESCRIPTIONFROM
switchScrollModeFunctionSwitch to a given scroll mode1.0.0
SwitchScrollModeReactElementCustomizable button to switch the scroll mode1.0.0
SwitchScrollModeButtonReactElementThe default button to switch the scroll mode1.0.0
SwitchScrollModeMenuItemReactElementThe default menu item to switch the scroll mode1.0.0
switchViewModeFunctionSwitch to a given viewmode1.0.0
SwitchViewModeReactElementCustomizable button to switch the viewmode1.0.0
SwitchViewModeButtonReactElementThe default button to switch the viewmode1.0.0
SwitchViewModeMenuItemReactElementThe default menu item to switch the viewmode1.0.0

The switchScrollMode function can be used to switch the current layout to a given mode programmatically:

javascript
import { ScrollMode } from "@sse-ui/pdf-core";

// Switch to the wrapped mode
switchScrollMode(ScrollMode.Wrapped);

2. Register the plugin

Register the scroll-mode plugin instance:

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

Properties

The scroll-mode plugin provides other useful properties as following:

PROPERTYTYPEDESCRIPTIONFROM
DualPageCoverViewModeIconReactElementThe icon represents the dual page with cover viewmode1.0.0
DualPageViewModeIconReactElementThe icon represents the dual page viewmode1.0.0
HorizontalScrollingIconReactElementThe icon represents the horizontal scroll mode1.0.0
PageScrollingIconReactElementThe icon represents the page scroll mode1.0.0
VerticalScrollingIconReactElementThe icon represents the vertical scroll mode1.0.0
WrappedScrollingIconReactElementThe icon represents the wrapped scroll mode1.0.0

Released under the MIT License.