react-pdf-viewer v2.5.0 Release Notes

  • 🆕 New features

    • 📱 The default layout is responsive in different screen sizes
    • You can add more options that will be passed to the pdf.js getDocument API:
    <Viewer
        fileUrl="..."
        transformGetDocumentParams={(options: PdfJs.GetDocumentParams) =>
            Object.assign({}, options, {
                disableRange: false,
                disableStream: false,
            })
        }
    />
    
    • Provide more reusable components:

    🔌 | Component                     | Provided by plugin                                                         | Description                   | | ------------------------------ | -------------------------------------------------------------------------- | ------------------------------ | 🔌 | DownloadMenuItem             | Get File                 | Download the current file     | 🔌 | EnterFullScreenMenuItem     | Full screen           | Enter the full screen mode     | 🔌 | GoToNextPageMenuItem         | Page Navigation   | Go to the next page           | 🔌 | GoToPreviousPageMenuItem     | Page Navigation   | Go to the previous page       | 🔌 | OpenMenuItem                 | Open                         | Open a new file               | 🔌 | PrintMenuItem               | Print                       | Print the current file         | 🔌 | ZoomInMenuItem               | Zoom                         | Zoom in the current file       | 🔌 | ZoomOutMenuItem             | Zoom                         | Zoom out the current file     |

    🔌 These components are available as Toolbar slots, so it's possible to add them to a custom toolbar

    👌 Improvements

    • 0️⃣ Decrease the number of renders from twice to once when setting the default scale
    • The Button and MenuItem components have disabled state. For example, the button for going to the first page will be disabled if we're at the first page
    • The icons use the current color instead of hard coded one. It's easier for us to create themes

    🐛 Bug fixes

    • Doesn't work with NextJS because navigator isn't defined
    • Some bookmarks are hidden initially
    • 0️⃣ The initialPage and defaultScale options don't work together
    • There are big spaces between thumbnails
    • Zoom the document best inside the container initially

    💥 Breaking changes

    • If you are creating a custom toolbar or buttons to go to particular pages, then the following props are renamed:
    Old name                       New name              
    GoToFirstPageProps           GoToPageProps      
    GoToLastPageProps           GoToPageProps      
    GoToNextPageProps           GoToPageProps      
    GoToPreviousPageProps       GoToPageProps      
    RenderGoToFirstPageProps     RenderGoToPageProps
    RenderGoToLastPageProps     RenderGoToPageProps
    RenderGoToNextPageProps     RenderGoToPageProps
    RenderGoToPreviousPageProps RenderGoToPageProps