react-pdf-viewer v3.9.0 Release Notes

  • ๐Ÿ†• New features

    • New pageLayout option to customize the layout of each page. The following code adds margin between pages, and center the page in its container:
    import { type PageLayout, Viewer } from '@react-pdf-viewer/core';
    
    const pageLayout: PageLayout = {
        buildPageStyles: () => ({
            alignItems: 'center',
            display: 'flex',
            justifyContent: 'center',
        }),
        tranformSize: ({ size }) => ({ height: size.height + 30, width: size.width + 30 }),
    };
    
    <Viewer pageLayout={pageLayout} />;
    

    ๐Ÿ› Bug fixes

    • Keep the current page after rotating the document

    ๐Ÿ›  Fix bugs that might happen with a document whose pages have different dimensions

    • Clicking a link annotation doesn't go to the correct destination position
    • Don't scroll to the top of the target page corresponding to the initialPage option

    ๐Ÿ’ฅ Breaking change

    • The pageHeight and pageWidth properties in RenderViewer are replaced with the pageSizes property that are the sizes of pages. You don't have to do anything if you don't develope your own plugin using those properties.