`setBookmarkExpanded`
property of the `Bookmarks`
component:import { bookmarkPlugin } from '@react-pdf-viewer/bookmark';const bookmarkPluginInstance = bookmarkPlugin();const { Bookmarks } = bookmarkPluginInstance;<Bookmarks isBookmarkExpanded={...} />;
`isBookmarkExpanded`
property is a function that accepts a single parameter consisting of the following properties:Property | Type | Description | From |
---|---|---|---|
`bookmark` | `PdfJs.Outline` | The bookmark data structure | 3.3.0 |
`depth` | `number` | The current depth | 3.3.0 |
`doc` | `PdfJs.PdfDocument` | The current document | 3.3.0 |
`index` | `number` | The zero-based index of bookmark relative to its parent | 3.3.0 |
// Expand bookmarks initiallyconst setBookmarkExpanded = ({ bookmark, depth, doc, index }) => true;// Collapse bookmarks initiallyconst setBookmarkExpanded = ({ bookmark, depth, doc, index }) => false;
const setBookmarkExpanded = ({ bookmark, depth, doc, index }) => depth === 0;<Bookmarks isBookmarkExpanded={setBookmarkExpanded} />;
Bookmark title | `depth` | `index` |
---|---|---|
`Contents` | 0 | 0 |
`Preface` | 0 | 1 |
`--- Who should read this guide?` | 1 | 0 |
`--- Related documentation` | 1 | 1 |
`Parameters for Opening PDF Files` | 0 | 2 |
`--- Parameters` | 1 | 0 |
`--- Specifying parameters in a URL` | 1 | 1 |
`------ URL examples` | 2 | 0 |
`------ URL limitations` | 2 | 1 |