react-pdf-viewer v2.3.0 Release Notes

  • ๐Ÿ†• New features

    • ๐Ÿ”Œ New highlight plugin provides the ability of selecting and adding notes for text in the document
    • 0๏ธโƒฃ The default-layout plugin allows to customize the tabs:
    // `defaultTabs` is the list of default tabs which lists thumbnails, bookmarks and attachments respetively
    const defaultLayoutPluginInstance = defaultLayoutPlugin({
        sidebarTabs: defaultTabs => { ... }
    });
    

    We also can activate a given tab:

    const { activateTab } = defaultLayoutPluginInstance;
    
    // Activate a tab
    // activateTab(index);
    

    ๐Ÿ’ฅ Breaking changes

    • ๐Ÿ”Œ The getPagesRef method in plugins are changed to getPagesContainer:
    // Before
    interface PluginFunctions {
        getPagesRef(): React.RefObject<HTMLDivElement>;
    }
    
    // After
    interface PluginFunctions {
        getPagesContainer(): HTMLElement;
    }
    
    • ๐Ÿšš The authorization option is removed. You can use new withCredentials option:
    // Before v2.3.0
    <Viewer
        fileUrl={...}
        authorization='Bearer ...'
    />
    
    // From v2.3.0
    <Viewer
        fileUrl={...}
        withCredentials={true}
        httpHeaders={{
            'Authorization': 'Bearer ...',
        }}
    />