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 ...',
        }}
    />