Plugins
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:
Property | Type | Description | From |
Print | ReactElement | Customizable print button | 2.0.0 |
PrintButton | ReactElement | The default print button | 2.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';
Property | Type | Description | From |
PrintIcon | ReactElement | The print icon | 2.0.0 |