diegomura / diegomura/react-pdf

Allow *any* bookmark tree structure (separate from DOM structure)

Open
#2,226 2 comments 1 reaction 0 assignees View on GitHub
new feature
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

Is it possible to define my own bookmark tree?

It would be nice to have an API like this:

```
const pdf_doc = () => {
const bookmarks = {
"title 1": {
"title 2": {}
}
};

return

{
bookmarks["title 1"]["title 2"] = el
}}>



}
```

Explanation:
- Map JSON's tree structure to the bookmark structure.
- Give the object ref to the ``, which after rendering has the complete bookmarks object and rendered page locations and can add the final bookmark listing to the PDF.
- Allow any PDF elements to be placed manually by the user to one or many locations in the tree.

The issue I have with the current bookmarks is that it takes the location in the DOM - it only allows linear book-chapter-like bookmarks. It also works unpredictably with auto page wrapping.

I need to create an index of topics - one element can be in many topics.

Thanks for the great lib and have a good day 🛸

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.