Bookmark plugin

The `bookmark` plugin lists all outline bookmarks of a PDF document. Clicking a bookmark item will jump to its associate section.

Install

npm install '@react-pdf-viewer/bookmark';
The `bookmark` plugin is included in the default-layout plugin

Usage

1. Import the plugin and styles
import { bookmarkPlugin } from '@react-pdf-viewer/bookmark';
// Import styles
import '@react-pdf-viewer/bookmark/lib/styles/index.css';
2. Create the plugin instance
const bookmarkPluginInstance = bookmarkPlugin();
The plugin instance `bookmarkPluginInstance` provides the following property:
PropertyTypeDescriptionFrom
`Bookmarks``ReactElement`The component lists outline bookmarks2.0.0
3. Register the plugin
Register the `bookmark` plugin instance, and use the `<Bookmarks />` component to list all bookmarks.
const { Bookmarks } = bookmarkPluginInstance;
<Viewer plugins={[bookmarkPluginInstance]} />;

Properties

The `bookmark` plugin provides other properties as following:
import { DownArrowIcon, RightArrowIcon } from '@react-pdf-viewer/bookmark';
PropertyTypeDescriptionFrom
`DownArrowIcon``ReactElement`The down arrow icon2.6.0
`RightArrowIcon``ReactElement`The right arrow icon2.0.0

See also

Changelog

v3.8.0
  • Keep the expanded/collapsed state of each bookmark
  • `RenderBookmarkItemProps` includes new `path` property that indicates the path from each bookmark item to the root
  • Set the `title` and `aria-label` attributes for link annotations without using the Bookmark plugin
v3.7.0
  • Clicking a particular bookmark might not go to the destination
  • The `Bookmark` component adds new `renderBookmarkItem` property
v3.3.0
  • A bookmark will be shown or hidden initially depending on its data structure
  • Align bookmark titles
  • The `Bookmarks` component addes new `setBookmarkExpanded` property
v2.6.0
  • Tweak toggle icons in bookmark items
v2.5.0
  • Some bookmarks are hidden initially
v2.4.2
  • Clicking a bookmark doesn't jump to the destination properly in the first time if the bookmark also requires to zoom the document to fit the width
v2.3.1
  • Clicking a bookmark with name of `FitH` or `FitBH` throws an exception
v2.2.0
  • Avoid the black flickering when clicking a bookmark
  • Clicking a bookmark doesn't jump to correct page in the horizontal scroll mode
v2.0.0
  • First release