import type { jsPDF as JsPdf } from 'jspdf'; import type { WorkPdfPageBounds } from './work-pdf-text-layer'; import { type WorkPdfRunHighlight, type WorkPdfRunUnderline, type WorkPdfStyledTextRun, type WorkPdfUnderlineKind } from './work-pdf-vector-text'; export type { WorkPdfRunHighlight, WorkPdfRunUnderline, WorkPdfUnderlineKind }; /** Bounded PDF paragraph-border stroke kinds (most art styles skip). */ export type WorkPdfParagraphBorderKind = 'single' | 'double' | 'thick' | 'dashed' | 'dotted' | 'wave' | 'doubleWave' | 'threeDEmboss' | 'threeDEngrave' | 'inset' | 'outset' | 'zigZag' | 'zigZagStitch' | 'sawtooth' | 'sharksTeeth' | 'triangles' | 'triangle1' | 'triangle2' | 'ovals' | 'rings' | 'marquee' | 'marqueeToothed' | 'moons' | 'bats' | 'birds' | 'birdsFlight' | 'cabins' | 'apples' | 'vine' | 'archedScallops' | 'babyPacifier' | 'babyRattle' | 'balloons3Colors' | 'balloonsHotAir' | 'cakeSlice' | 'candyCorn' | 'celticKnotwork' | 'certificateBanner' | 'chainLink' | 'champagneBottle' | 'checkedBarBlack' | 'checkedBarColor' | 'checkered' | 'basicBlackSquares' | 'basicWhiteSquares' | 'basicBlackDots' | 'basicWhiteDots' | 'basicBlackDashes' | 'basicWhiteDashes' | 'basicThinLines' | 'basicWideInline' | 'basicWideMidline' | 'basicWideOutline'; /** * PDF stroke edges for Writer paragraph borders. `between` maps to the bottom * of the measured box (DOM inset-bottom approximation); `bar` maps to the left * (DOM inset-left / facing-page bar approximation). */ export type WorkPdfParagraphBorderBoxEdge = 'top' | 'left' | 'bottom' | 'right' | 'between' | 'bar'; export interface WorkPdfParagraphBorderEdgeStroke { color: string; kind: WorkPdfParagraphBorderKind; /** CSS pixel width from Writer presentation helpers. */ width: number; } export interface WorkPdfParagraphBorderBox { edges: Partial>; height: number; width: number; x: number; y: number; } type WorkPdfPaintPageCss = { height: number; width: number; }; type WorkPdfPaintPagePoints = { pageHeightPoints: number; pageWidthPoints: number; }; /** * Resolves a Writer/CSS highlight on a text host into an opaque PDF fill color. * Only the portable highlight palette is admitted; `none` and transparent skip. */ export declare function workPdfRunHighlightFromElement(element: HTMLElement): WorkPdfRunHighlight | null; /** * Resolves a Writer/CSS underline on a text host into a PDF stroke plan. * Unknown decorative styles map to a single solid line (bounded approximation). */ export declare function workPdfRunUnderlineFromElement(element: HTMLElement): WorkPdfRunUnderline | null; /** * Paints highlight background fills as native PDF path operators using the same * page geometry as the vector text layer (under text, above the raster page). */ export declare function appendWorkPdfVectorHighlightLayer(pdf: JsPdf, runs: readonly WorkPdfStyledTextRun[], pageCss: WorkPdfPaintPageCss, pagePoints: WorkPdfPaintPagePoints): void; /** * Clears a thin strip under underlined vector runs so residual CSS decoration * does not double-paint with the PDF stroke layer. */ export declare function clearWorkPdfUnderlineStripsOnCanvas(canvas: HTMLCanvasElement, runs: readonly WorkPdfStyledTextRun[], pageCss: WorkPdfPaintPageCss, fillStyle: string): void; /** * Paints underline strokes as native PDF path operators using the same page * geometry as the vector text layer (no second layout model). */ export declare function appendWorkPdfVectorUnderlineLayer(pdf: JsPdf, runs: readonly WorkPdfStyledTextRun[], pageCss: WorkPdfPaintPageCss, pagePoints: WorkPdfPaintPagePoints): void; /** * Resolves Writer paragraph borders on a block into a bounded PDF stroke plan. * Admits top/left/bottom/right plus between/bar line styles, including explicit * `wave` / `doubleWave` polylines, dual-tone 3D / inset / outset relief strokes, * and geometric `zigZag` / `zigZagStitch` / `sawtooth` / `sharksTeeth` / * `triangles` / `triangle1` / `triangle2` / `ovals` / `rings` / `marquee` / * `marqueeToothed` / `moons` / `bats` / `birds` / `birdsFlight` / `cabins` / * `apples` / `vine` / `archedScallops` / `babyPacifier` / `babyRattle` / `balloons3Colors` / `balloonsHotAir` / `cakeSlice` / `candyCorn` / `celticKnotwork` / `certificateBanner` / `chainLink` / `champagneBottle` / `checkedBarBlack` / `checkedBarColor` / `checkered` / `basicBlackSquares` / `basicWhiteSquares` / * `basicBlackDots` / `basicWhiteDots` / `basicBlackDashes` / * `basicWhiteDashes` / `basicThinLines` / `basicWideInline` / * `basicWideMidline` / `basicWideOutline` art motifs; other art border styles are * skipped (fail * closed). Not PDF/UA. */ export declare function workPdfParagraphBordersFromElement(element: HTMLElement): Partial> | null; /** * Collects measured paragraph border boxes in page-local CSS pixels. Geometry * comes from live DOM rects (same page model as text / outline collectors). */ export declare function collectWorkPdfParagraphBorderBoxes(root: HTMLElement, page: WorkPdfPageBounds): WorkPdfParagraphBorderBox[]; /** * Clears thin CSS border strips on the raster page so vector strokes do not * double-paint residual html2canvas borders. */ export declare function clearWorkPdfParagraphBorderStripsOnCanvas(canvas: HTMLCanvasElement, boxes: readonly WorkPdfParagraphBorderBox[], pageCss: WorkPdfPaintPageCss, fillStyle: string): void; /** * Paints paragraph borders as native PDF path operators at measured paragraph * geometry (common + wave + 3D + zigZag/sawtooth/triangle/oval/marquee/moon/ * moons/bats/birds/cabins/apples/vine/archedScallops/babyPacifier/babyRattle/balloons3Colors/balloonsHotAir/cakeSlice/candyCorn/celticKnotwork/certificateBanner/chainLink/champagneBottle/checkedBarBlack/checkedBarColor/checkered/basicSquares/basicDots/ * basicDashes/basicThinLines/basicWide art; not PDF/UA or remaining decorative * art). */ export declare function appendWorkPdfVectorParagraphBorderLayer(pdf: JsPdf, boxes: readonly WorkPdfParagraphBorderBox[], pageCss: WorkPdfPaintPageCss, pagePoints: WorkPdfPaintPagePoints): void;