`get-file`
plugin provides a button that can be used to download the PDF document. It is able to customize the download button as well.npm install '@react-pdf-viewer/get-file';
import { getFilePlugin } from '@react-pdf-viewer/get-file';
const getFilePluginInstance = getFilePlugin(props?: GetFilePluginProps);
`getFilePlugin()`
function takes a `GetFilePluginProps`
parameter that consists of the following property:Property | Type | Description | From |
---|---|---|---|
`fileNameGenerator` | `OpenFile => String` | Generate the name of download file | 2.0.0 |
`getFilePluginInstance`
provides the following properties:Property | Type | Description | From |
---|---|---|---|
`Download` | `ReactElement` | Customizable download button | 2.0.0 |
`DownloadButton` | `ReactElement` | The default download button | 2.0.0 |
`DownloadMenuItem` | `ReactElement` | The default download menu item | 2.5.0 |
`get-file`
plugin instance:<Viewer plugins={[getFilePluginInstance]} />
`get-file`
plugin provides other useful property as following:import { DownloadIcon } from '@react-pdf-viewer/open';
Property | Type | Description | From |
---|---|---|---|
`DownloadIcon` | `ReactElement` | The download file icon | 2.0.0 |
`DownloadIcon`
component`document.pdf`
instead of the document blob`Download button`
doesn't work. It only works the file when scrolling to the second page