/** * flattenVisuals — desugar `visual` components to plain `image` components ahead * of time, producing a portable, service-free `.docx.json`. * * The normal pipeline rasterizes `visual` nodes at render time via * `services.pptx`. This transform does the same desugaring offline: walk the * document tree, rasterize each `visual` with the supplied rasterizer, and * replace it with `{ name: 'image', props: { base64, ... } }`. The result builds * with no rasterization service configured — handy for shipping documents that * generate on hosts without LibreOffice/poppler. * * The walk covers every place the docx model can hold a child component, not * just `children`: section `props.header`/`props.footer`, and table * `props.columns[].cells[].content` / `props.columns[].header.content`. */ import { type PptxRasterizer, type PptxBatchRasterizer, type RasterizeFontFace } from '@json-to-office/shared'; export interface FlattenVisualsOptions { /** Rasterizer that turns a single-slide pptx presentation into a PNG. */ rasterize: PptxRasterizer; /** * Batch rasterizer (#153). When provided, all visuals are collected and * rasterized together up front; `rasterize` remains the per-visual * fallback for batch failures and anything the collection missed. */ rasterizeBatch?: PptxBatchRasterizer; /** Default DPI applied when a `visual` does not specify one (default 200). */ dpi?: number; /** Max concurrent rasterizations (default 4). */ concurrency?: number; /** * Directory that relative asset paths inside visuals resolve against — * the document's own directory. Absent → the rasterizer's cwd (#142). */ baseDir?: string; /** * Font faces staged for each visual's LibreOffice render. Without these a * flattened document bakes in fontless PNGs permanently — the flatten * output is a portable, service-free `.docx.json`, so there is no second * chance to re-rasterize with the right fonts. */ fonts?: readonly RasterizeFontFace[]; } /** * Return a deep copy of `doc` with every `visual` node replaced by the `image` * node it rasterizes to. With `rasterizeBatch`, visuals are pre-rasterized in * batches and the tree walk resolves from the batch results; otherwise (and * for any batch miss) visuals rasterize per-node with bounded concurrency. A * `visual` with `enabled: false` is left untouched (it's filtered out at render * anyway, so rasterizing it would be wasted work). Non-visual nodes are copied * structurally and otherwise unchanged. */ export declare function flattenVisuals(doc: T, options: FlattenVisualsOptions): Promise; //# sourceMappingURL=flattenVisuals.d.ts.map