`renderProgressBar`
property:import { printPlugin } from '@react-pdf-viewer/print';const printPluginInstance = printPlugin({renderProgressBar: customProgressBar,});
const customProgressBar = (numLoadedPages: number, numPages: number, onCancel: () => void) => (// Your own progress bar);
Parameter | Type | Description | From |
---|---|---|---|
`numLoadedPages` | `number` | The number of pages which have been prepared and ready to print | 3.6.0 |
`numPages` | `number` | The total number of pages that will be printed | 3.6.0 |
`onCancel` | `Function` | Cancel print | 3.6.0 |
`Button`
and `Spinner`
components to render a custom progress bar:import { Button, Spinner } from '@react-pdf-viewer/core';const customProgressBar = (numLoadedPages: number, numPages: number, onCancel: () => void) => (<div><div style={{ marginBottom: '1rem' }}>Preparing {numLoadedPages}/{numPages} pages ...</div><div style={{ marginBottom: '1rem' }}><Spinner /></div><Button onClick={onCancel}>Cancel</Button></div>);
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';const defaultLayoutPluginInstance = defaultLayoutPlugin({toolbarPlugin: {printPlugin: {renderProgressBar: customProgressBar,},},});