react-pdf-viewer v2.9.0 Release Notes

  • 🆕 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
    • 0️⃣ The Default Layout plugin allows to resize the sidebar
    • 0️⃣ 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 |

    0️⃣ 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,
            },
        },
    });