import type { jsPDF as JsPdf } from 'jspdf'; export interface WorkPdfOutlineEntry { /** 1-based outline level for nesting (h1 / outlineLvl 0 → 1 … outlineLvl 8 → 9). */ level?: number; pageNumber: number; title: string; } export interface WorkPdfDocumentStructure { language?: string; outline?: readonly WorkPdfOutlineEntry[]; title?: string; } /** Filled when the deferred Link annotation object is materialized on putPage. */ export interface WorkPdfAnnotObjectRef { objectId: number | null; } /** * Applies bounded PDF document metadata and outline bookmarks. This is the * tagged/accessibility bootstrap: language (catalog + StructElem `/Lang`) + * title (Info dict + Document StructElem `/Alt`) + heading outline + MarkInfo * (Marked + Suspects false) + catalog Tabs /S + StructTreeRoot (Document / * H1–H6 / P with /Pg) with ParentTree / MCID links for vector-run Span content, * and `/Link` / `/Figure` / `/Table` StructElems for registered external URI * hotspots (Link kids may carry `/OBJR` to deferred URI annotations), alt-text * images, and simple HTML tables, without claiming full PDF/UA certification. */ export declare function applyWorkPdfDocumentStructure(pdf: JsPdf, structure: WorkPdfDocumentStructure): void; /** * Writes catalog `/Lang` for any normalized BCP-47-like tag via putCatalog. * Prefer this over jsPDF `setLanguage`, which silently skips tags outside its * fixed enum (for example `yue`). Not a PDF/UA certification claim. */ export declare function ensureWorkPdfCatalogLang(pdf: JsPdf, language: string | null): void; /** * Declares `/MarkInfo << /Marked true /Suspects false >>` once via jsPDF's * putCatalog hook so ActualText Span marked content is catalog-visible and * structure suspects are denied. Not a PDF/UA certification claim. */ export declare function ensureWorkPdfMarkInfo(pdf: JsPdf): void; /** * Declares `/ViewerPreferences << /DisplayDocTitle true >>` so tagged-PDF * consumers prefer the document title. Not a PDF/UA certification claim. */ export declare function ensureWorkPdfViewerPreferences(pdf: JsPdf): void; /** * Declares catalog `/Tabs /S` so tagged-PDF consumers follow structure-tree * reading order. Not a PDF/UA certification claim. */ export declare function ensureWorkPdfStructTabs(pdf: JsPdf): void; /** * Emits StructTreeRoot (Document + outline-derived H1–H6/P + Span content * links) with ParentTree / page StructParents via jsPDF hooks. * Outline roles nest by level under parent `/K` (same stack as bookmarks); * page-matched Spans nest under the last outline role on that page (H1–H6 * wrap those Spans in a child `/P`; outline-level `/P` keeps Spans direct); * unmatched Spans nest under a page-level `/P` under Document; document * language is copied onto outline / `/P` / Span StructElems when set; document * title is copied onto Document StructElem `/Alt` when set. Not a full PDF/UA * certification claim. */ export declare function ensureWorkPdfStructTreeRoot(pdf: JsPdf, plan: { language?: string | null; outline?: readonly WorkPdfOutlineEntry[]; title?: string | null; }): void; /** * Maps outline levels to PDF structure roles: 1–6 → H1–H6, else P. * Exported for unit coverage of the role boundary. */ export declare function workPdfStructRoleFromOutlineLevel(level: number): string; /** * Seeds catalog + StructTree language before vector paint so Span BDC can * include `/Lang`. Safe to call repeatedly; outline may be filled later by * {@link applyWorkPdfDocumentStructure}. Not a PDF/UA certification claim. */ export declare function seedWorkPdfDocumentLanguage(pdf: JsPdf, language?: string): void; /** * Opens a `/Span` BDC with `/ActualText` and a page-local `/MCID` for a vector * text run. Pairs with {@link endWorkPdfActualTextSpan}. Fail-soft when jsPDF * internals are absent; falls back to ActualText-only when the MCID budget is * exhausted. When document language was seeded, includes `/Lang` on the BDC. */ export declare function beginWorkPdfActualTextSpan(pdf: JsPdf, text: string): boolean; /** Closes a Span marked-content sequence opened by {@link beginWorkPdfActualTextSpan}. */ export declare function endWorkPdfActualTextSpan(pdf: JsPdf): void; /** * Opens an `/Artifact << /Type /Layout >> BDC` region for decorative vector * paint (highlights, underlines, paragraph borders) so assistive tech can skip * layout decoration. No MCID or StructElem. Pairs with {@link endWorkPdfArtifact}. */ export declare function beginWorkPdfArtifact(pdf: JsPdf): boolean; /** Closes an Artifact marked-content sequence opened by {@link beginWorkPdfArtifact}. */ export declare function endWorkPdfArtifact(pdf: JsPdf): void; /** * Queues a deferred URI `/Link` annotation as an indirect page Annot so a * StructElem `/OBJR` can reference it. Object ids are allocated lazily during * jsPDF `putPage` (via a getter) to avoid colliding with the page object id. * Fail-soft when annotation hooks are unavailable. */ export declare function queueWorkPdfUriLinkAnnotation(pdf: JsPdf, entry: { annotRef: WorkPdfAnnotObjectRef; height: number; href: string; width: number; x: number; y: number; }): void; /** * Registers a `/Link` StructElem for an external URI hotspot on the current * (or explicit) page. When `annotRef` is supplied and later filled by * {@link queueWorkPdfUriLinkAnnotation}, the StructElem `/K` carries an * `/OBJR` to that annotation. Fail-soft when structure hooks are unavailable. * Not a PDF/UA certification claim. */ export declare function registerWorkPdfLinkStructEntry(pdf: JsPdf, entry: { alt?: string; annotRef?: WorkPdfAnnotObjectRef; href: string; pageNumber?: number; }): void; /** * Registers a `/Figure` StructElem for an image with non-empty alt text on the * current (or explicit) page and emits a page-local `/Figure` BDC+MCID marker * so the StructElem `/K` can reference marked content. Fail-soft when structure * hooks are unavailable. Not a PDF/UA certification claim; content-stream * figure paint stays whatever the page raster already embeds. */ export declare function registerWorkPdfFigureStructEntry(pdf: JsPdf, entry: { alt: string; pageNumber?: number; }): void; /** * Registers a `/Table` → `/TR` → `/TH`|`/TD` StructElem tree for a simple HTML * table on the current (or explicit) page. Fail-soft when structure hooks are * unavailable. Not a PDF/UA certification claim. */ export declare function registerWorkPdfTableStructEntry(pdf: JsPdf, table: { pageNumber?: number; rows: readonly { cells: readonly { alt: string; header: boolean; }[]; }[]; }): void; /** * Encodes an ActualText operand: PDF literal for Latin-1, UTF-16BE hex (BOM) * otherwise. Exported for unit coverage of the escape boundary. */ export declare function encodePdfActualTextOperand(text: string): string; export declare function collectWorkPdfOutlineEntriesFromRoot(root: HTMLElement, pageNumber: number, pageBounds?: { height: number; left: number; top: number; width: number; }): WorkPdfOutlineEntry[]; export declare function normalizePdfLanguage(language: string | undefined): string | null;