react-pdf-viewer v2.7.2 Release Notes
-
๐ New feature
๐ The
Search
plugin provides new function namedsetTargetPages
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 - 0๏ธโฃ 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 thedata
andname
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
- 0๏ธโฃ The
activateTab()
method provided by the default layout plugin shouldn't toggle the tab - โก๏ธ The
LocalePopover
component doesn't update the localization - 0๏ธโฃ The pages' container overflows on initial render when setting the default scale to
SpecialZoomLevel.PageWidth
- Allow to change the theme from outside of the