yarn @react-pdf-viewer/core 2.7.2
v2.7.2

latest releases: 3.12.0, 3.11.0, 3.10.0...
2 years ago

New feature

The Search plugin provides new function named setTargetPages which sets the pages that you want to search in.

import { searchPlugin } from '@react-pdf-viewer/search';

const searchPluginInstance = searchPlugin();
const { setTargetPages } = searchPluginInstance;

// Only search in even pages
setTargetPages((targetPage) => targetPage.pageIndex % 2 === 0);

// Only search in the page 4
setTargetPages((targetPage) => targetPage.pageIndex === 3);

Improvements

  • Allow to change the theme from outside of the Viewer component
  • When the default scale is set to a special zoom level, we should keep it when resizing the window
  • The onDocumentLoad event and plugins' PluginOnDocumentLoad callback provide access to the current opened file which contains the data and name properties:
const handleDocumentLoad = (e: DocumentLoadEvent) => {
    console.log(e.file.name, e.file.data);
};

<Viewer onDocumentLoad={handleDocumentLoad} />;

Bug fixes

  • Can't close the menu when using with the Fluent UI
  • The activateTab() method provided by the default layout plugin shouldn't toggle the tab
  • The LocalePopover component doesn't update the localization
  • The pages' container overflows on initial render when setting the default scale to SpecialZoomLevel.PageWidth

Don't miss a new core release

NewReleases is sending notifications on new releases.