react-pdf-viewer v1.2.0 Release Notes
-
๐ New features
- ๐จ Provide the ability of printing document
- โ Add new
selectionMode
option indicates the selection mode:
import Viewer, { SelectionMode } from '@phuocng/react-pdf-viewer'; <Viewer fileUrl='/path/to/document.pdf' // By default, it will be SelectionMode.Text selectionMode={SelectionMode.Hand} />
- โ Add
onDocumentLoad
callback that uis invoked when the document is loaded completely
import Viewer, { PdfJs } from '@phuocng/react-pdf-viewer'; const documentLoad = (doc: PdfJs.PdfDocument) => { console.log(`Document is loaded: ${doc.numPages}`) }; <Viewer fileUrl='/path/to/document.pdf' onDocumentLoad={documentLoad} />
- โ Add
onZoom
callback that is invoked when zooming in/out the document
import Viewer, { PdfJs } from '@phuocng/react-pdf-viewer'; const zoom = (doc: PdfJs.PdfDocument, scale: number) => { console.log(`Zoom document to ${scale}`); }; <Viewer fileUrl='/path/to/document.pdf' onZoom={zoom} />