`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.npm install '@react-pdf-viewer/open';
import { openPlugin } from '@react-pdf-viewer/open';// Import stylesimport '@react-pdf-viewer/open/lib/styles/index.css';
const openPluginInstance = openPlugin(props?: OpenPluginProps);
`openPlugin()`
function takes an optional `OpenPluginProps`
parameter that consists of the following property:Property | Type | Description | From |
---|---|---|---|
`enableShortcuts` ? | `boolean` | Enable shortcuts | 2.9.0 |
`ctrl`
+ `O`
to open a document.`openPluginInstance`
provides the following properties:Property | Type | Description | From |
---|---|---|---|
`Open` | `ReactElement` | Customizable open button | 2.0.0 |
`OpenButton` | `ReactElement` | The default open button | 2.0.0 |
`OpenMenuItem` | `ReactElement` | The default open menu item | 2.5.0 |
`open`
plugin instance:<Viewer plugins={[openPluginInstance]} />
`open`
plugin provides other useful property as following:import { OpenFileIcon } from '@react-pdf-viewer/open';
Property | Type | Description | From |
---|---|---|---|
`OpenFileIcon` | `ReactElement` | The open file icon | 2.0.0 |
`OpenFileIcon`
component`Open file button`
covers other elements, so we can't click on the Download or Print buttons. This issue only happens on Safari 14