yarn @react-pdf-viewer/core 3.9.0
Margin between pages

latest releases: 3.12.0, 3.11.0, 3.10.0...
23 months ago

New feature

  • 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.

Don't miss a new core release

NewReleases is sending notifications on new releases.