Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bookmarks

Add navigation bookmarks (outlines) to PDF documents.

Adding Bookmarks

#![allow(unused)]
fn main() {
use printwell::bookmarks::{Bookmark, add_bookmarks};

let bookmarks = vec![
    Bookmark::new("Introduction", 1),
    Bookmark::new("Chapter 1", 3),
    Bookmark::new("Chapter 2", 10),
    Bookmark::new("Conclusion", 25),
];

let result = add_bookmarks(&pdf_data, &bookmarks)?;
}

Hierarchical Bookmarks

Create nested bookmark structures:

#![allow(unused)]
fn main() {
let bookmarks = vec![
    Bookmark::new("Part 1", 1).with_children(vec![
        Bookmark::new("Chapter 1", 2),
        Bookmark::new("Chapter 2", 15).with_children(vec![
            Bookmark::new("Section 2.1", 15),
            Bookmark::new("Section 2.2", 20),
        ]),
    ]),
    Bookmark::new("Part 2", 30).with_children(vec![
        Bookmark::new("Chapter 3", 31),
        Bookmark::new("Chapter 4", 45),
    ]),
];
}

Bookmark Options

#![allow(unused)]
fn main() {
Bookmark::new("Title", page)
    .y_position(500.0)  // Y position on page (optional)
    .open(true)         // Expanded by default
    .level(0)           // Nesting level
}

Extracting Bookmarks

#![allow(unused)]
fn main() {
use printwell::bookmarks::extract_bookmarks;

let bookmarks = extract_bookmarks(&pdf_data)?;

for bookmark in &bookmarks {
    println!("{} -> Page {}", bookmark.title, bookmark.page);
}
}

Node.js Example

import { addBookmarks, extractBookmarks } from 'printwell';

const result = addBookmarks(pdfData, [
    { title: 'Chapter 1', page: 1 },
    { title: 'Chapter 2', page: 10, children: [
        { title: 'Section 2.1', page: 10 },
        { title: 'Section 2.2', page: 15 }
    ]}
]);

const existing = extractBookmarks(pdfData);

Python Example

from printwell import add_bookmarks, extract_bookmarks, Bookmark

bookmarks = [
    Bookmark("Chapter 1", page=1),
    Bookmark("Chapter 2", page=10),
]

result = add_bookmarks(pdf_data, bookmarks)
existing = extract_bookmarks(pdf_data)