yarn @react-pdf-viewer/core 2.9.0
v2.9.0

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

New features

  • The core package provides new Splitter component
  • The thumbnail plugin provides new Cover component that shows the thumbnail of a particular page:
const { thumbnailPluginInstance } = thumbnailPlugin();
const { Cover } = thumbnailPluginInstance;

// Thumbnail of the first page
<Cover getPageIndex={_ => 0} />

// Thumbnail of the last page
<Cover getPageIndex={props => props.numPages - 1} />
  • Add new onDocumentAskPassword event that is triggered when a protected document requires a password to open:
const handleAskPassword = (e: DocumentAskPasswordEvent) => {
    // ...
};

<Viewer onDocumentAskPassword={handleAskPassword} />;

Improvements

  • Automatically focus on the keyword input in the search popover
  • Press Enter to submit the password when opening a protected document
  • Show the page numbers for thumbnails
  • The Default Layout plugin allows to resize the sidebar
  • The plugin instances which can be accessed from an instance of the Default Layout or Toolbar plugin should be readonly
  • Support more shortcuts
Shortcut Supported plugin Action
ctrl + cmd + F or F11 Full screen Enter the full screen mode
cmd + O Open Open a document
cmd + F Search Open the search popover

The shortcuts are enabled by default. It's possible to disable them, for example:

// Use the standalone open plugin
const openPluginInstance = openPlugin({
    enableShortcuts: false,
});

// Use the default layout plugin
const defaultLayoutPluginInstance = defaultLayoutPlugin({
    toolbarPlugin: {
        openPlugin: {
            enableShortcuts: false,
        },
    },
});

Don't miss a new core release

NewReleases is sending notifications on new releases.