Skip to content

Print plugin

The print plugin provides a button to print the current PDF document. It is possible to customize the button as well.

Install

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

OR

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

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

Usage

1. Import the plugin

javascript
import { printPlugin } from "@sse-ui/pdf-print";

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

2. Create the plugin instance

javascript
const printPluginInstance = printPlugin(props?: PrintPluginProps);

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

PROPERTYTYPEDESCRIPTIONFROM
enableShortcuts?booleanEnable shortcuts1.0.0
renderProgressBarFunctionCustomize the progress bar when preparing pages to print.1.0.0
setPages?FunctionSet target pages that will be printed.1.0.0

By default, the shortcut is enabled. Users can press ctrl + P to print the current document. The plugin instance printPluginInstance provides the following properties:

PROPERTYTYPEDESCRIPTIONFROM
printFunctionPrint the current document. See this example1.0.0
PrintReactElementCustomizable print button1.0.0
PrintButtonReactElementThe default print button1.0.0
PrintMenuItemReactElementThe default print menu item1.0.0

3. Register the plugin

Register the print plugin instance:

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

Properties

The print plugin provides other useful property as following:

javascript
import { PrintIcon } from "@sse-ui/pdf-print";
PROPERTYTYPEDESCRIPTIONFROM
PrintIconPrintIconThe print icon1.0.0

Released under the MIT License.