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}
    />