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

Usage

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

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

The plugin instance printPluginInstance provides the following properties:

PropertyTypeDescriptionFrom
PrintReactElementCustomizable print button2.0.0
PrintButtonReactElementThe default print button2.0.0
  • Finally, register the print plugin instance:
<Viewer
    fileUrl='...'
    plugins={[
        printPluginInstance,
    ]}
/>

Properties

The print plugin provides other useful property as following:

import { PrintIcon } from '@react-pdf-viewer/print';
PropertyTypeDescriptionFrom
PrintIconReactElementThe print icon2.0.0

Examples