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 '@react-pdf-viewer/open';

Usage

  • Import the plugin and styles:
import { openPlugin } from '@react-pdf-viewer/open';

// Import styles
import '@react-pdf-viewer/open/lib/styles/index.css';
  • Create the plugin instance:
const openPluginInstance = openPlugin();

The plugin instance openPluginInstance provides the following properties:

PropertyTypeDescriptionFrom
OpenReactElementCustomizable open button2.0.0
OpenButtonReactElementThe default open button2.0.0
OpenMenuItemReactElementThe default open menu item2.5.0
  • Finally, register the open plugin instance:
<Viewer
    fileUrl='...'
    plugins={[
        openPluginInstance,
    ]}
/>

Properties

The open plugin provides other useful property as following:

import { OpenFileIcon } from '@react-pdf-viewer/open';
PropertyTypeDescriptionFrom
OpenFileIconReactElementThe open file icon2.0.0

Examples