Skip to content

Open plugin

The open plugin provides a button that can be used to open a PDF document in your computer. It is possible to customize the button as well.

Install

> npm install '@sse-ui/pdf-open';

OR

> yarn add '@sse-ui/pdf-open';

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

Usage

1. Import the plugin

javascript
import { openPlugin } from "@sse-ui/pdf-open";

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

2. Create the plugin instance

javascript
const openPluginInstance = openPlugin(props?: OpenPluginProps);

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

PROPERTYTYPEDESCRIPTIONFROM
enableShortcuts?booleanEnable shortcuts1.0.0

By default, the shortcuts are enabled. Users can press ctrl + O to open a document. The plugin instance openPluginInstance provides the following properties:

PROPERTYTYPEDESCRIPTIONFROM
OpenReactElementCustomizable open button1.0.0
OpenButtonReactElementThe default open button1.0.0
OpenMenuItemReactElementThe default open menu item1.0.0

3. Register the plugin

Register the open plugin instance:

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

Properties

The open plugin provides other useful property as following:

javascript
import { OpenFileIcon } from "@sse-ui/pdf-open";
PROPERTYTYPEDESCRIPTIONFROM
OpenFileIconReactElementThe open file icon1.0.0

Released under the MIT License.