/** * PDF annotation extractor. * * Extracts annotations from a PDF page's `/Annots` array. * Supports all standard annotation subtypes defined in PDF Reference 1.7, §12.5. * * Common annotation types: * - **Link** — Hyperlinks (URI, GoTo, GoToR) * - **Text** — Sticky notes / comments * - **FreeText** — Inline text annotations * - **Highlight / Underline / StrikeOut / Squiggly** — Text markup * - **Stamp** — Rubber stamp annotations * - **Popup** — Associated popup windows * - **Widget** — Form field widgets (handled separately by form-extractor) * * @see PDF Reference 1.7, §12.5 - Annotations */ import type { PdfDocument } from "./pdf-document.js"; import type { PdfDictValue } from "./pdf-parser.js"; /** Rectangle in PDF coordinate space [x1, y1, x2, y2] */ export interface PdfRect { /** Left edge (x1) */ x1: number; /** Bottom edge (y1) */ y1: number; /** Right edge (x2) */ x2: number; /** Top edge (y2) */ y2: number; } /** A PDF annotation extracted from a page. */ export interface PdfAnnotation { /** Annotation subtype (e.g. "Link", "Text", "Highlight", "FreeText", "Stamp") */ subtype: string; /** Bounding rectangle in page coordinates (points) */ rect: PdfRect; /** Text content (/Contents entry) */ contents: string; /** Author / title (/T entry) */ author: string; /** Subject (/Subj entry) */ subject: string; /** Modification date (/M entry) — raw PDF date string */ modifiedDate: string; /** For Link annotations: the destination URI */ uri: string; /** For Link annotations: named destination */ destination: string; /** Annotation flags (/F entry) */ flags: number; /** Color (/C entry) — array of 0-3 values in [0,1] */ color: number[]; } /** * Extract annotations from a PDF page. * * Skips Widget annotations (form fields) — those are handled by the form extractor. * * @param pageDict - The page dictionary * @param doc - The PDF document for resolving references * @returns Array of extracted annotations */ export declare function extractAnnotationsFromPage(pageDict: PdfDictValue, doc: PdfDocument): PdfAnnotation[];