Skip to content

v2.7.2

Compare
Choose a tag to compare
@phuocng phuocng released this 23 Aug 14:09
d5084b2

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