/** * PDF bookmark (outline) extractor. * * Extracts the document outline tree from a PDF's `/Outlines` dictionary. * Each outline item has a title, a target page index, and optional children * forming a hierarchical bookmark tree. * * Supports: * - Direct destinations (`/Dest` as array or named destination) * - Action-based destinations (`/A << /S /GoTo /D ... >>`) * - Nested bookmarks (children via `/First`/`/Last` chains) * - Circular reference protection * * @see PDF Reference 1.7, §12.3 - Document-Level Navigation */ import type { PdfDocument } from "./pdf-document.js"; /** A bookmark (outline item) extracted from the PDF. */ export interface PdfBookmark { /** Bookmark title text */ title: string; /** 0-based page index the bookmark points to (-1 if unresolvable) */ pageIndex: number; /** Child bookmarks (nested outline items) */ children: PdfBookmark[]; } /** * Extract bookmarks (outlines) from a PDF document. * * Reads the `/Outlines` dictionary from the catalog and recursively * traverses the outline tree following `/First` → `/Next` chains. * * @param doc - The PDF document * @returns Array of top-level bookmarks with nested children */ export declare function extractBookmarks(doc: PdfDocument): PdfBookmark[];