import { FontBytesByVariant, FontRegistry } from '../core/font/index.js'; import { FamilyKey, FetchLike } from '../core/fonts/index.js'; import { SignatureOptions, StyledRenderOptions } from '../pdf/index.js'; /** * Options for the `.docx` → PDF converters. Extends the low-level * {@link StyledRenderOptions} (minus the font `registry` and `styles`, which the * converter builds itself) with font supply, substitute-font hints and two * source-touching conveniences. */ export interface ConvertDocxOptions extends Omit { /** A single regular-variant font as raw bytes. */ readonly fontBytes?: Uint8Array; /** Explicit font bytes per variant (regular/bold/italic/bold-italic). */ readonly fonts?: FontBytesByVariant; /** * Force a substitute font family for the auto-download path (e.g. `'serif'`). * Ignored when `fonts`/`fontBytes` are supplied. */ readonly fontFamily?: string; /** Injectable `fetch` for the auto-download path (defaults to the global `fetch`). */ readonly fontFetch?: FetchLike; /** * For PDF/A-3 only: embed the input `.docx` as an associated source file * (`/AFRelationship /Source`) so the archive carries its own source. Ignored * for other profiles (PDF/A-1/2 forbid arbitrary embedded files). */ readonly embedSource?: boolean; /** * Digitally sign the output (ISO 32000 §12.8). Requires the async * {@link convertDocxToPdf} (signing uses WebCrypto); ignored by the sync converter. */ readonly signature?: SignatureOptions; } /** * Synchronous one-shot conversion (requires `fonts`/`fontBytes`, no network). * * Internal since 1.0 — see the async variant above. */ export declare function convertDocxToPdfSync(docx: Uint8Array, options: ConvertDocxOptions): Uint8Array; /** * The distinct curated font families the document references — the `w:ascii` of * `styles.xml` + `document.xml`, and the theme slots they point at instead * (§17.3.2.26) — always including the sans default `'arimo'` as a fallback for * unstyled runs / math / charts. The async path fetches one substitute set per * family so each run renders in the right one. * * @param docx The `.docx` bytes. * @returns The resolved {@link FamilyKey} set; just the default when the package * cannot be opened. */ export declare function detectDocxFamilyKeys(docx: Uint8Array): Set; /** * One-shot .docx → PDF (auto-downloads a substitute font set when the caller * supplies none; zero network with `fonts`/`fontBytes`). * * Internal since 1.0 — the public entry is `Ream.parse(bytes).convert('pdf')`; * the createConverter facade and the test suite drive this directly. */ export declare function convertDocxToPdf(docx: Uint8Array, options?: ConvertDocxOptions): Promise; /** * Substitute-font auto-download for a `.docx` without caller-supplied fonts: * detect the families used and fetch an open set per family (a single-family * document takes the simple one-family path). Shared by the converter and the * {@link Ream} facade — both work from the same source bytes. * * @param docx The `.docx` bytes. * @param options Optional `fontFamily` override and injectable `fontFetch`. * @returns The base font bytes plus, for a multi-family document, a per-family * registry map so each run resolves to its own substitute. */ export declare function resolveDocxAutoFonts(docx: Uint8Array, options?: { readonly fontFamily?: string; readonly fontFetch?: FetchLike; }): Promise<{ fonts: FontBytesByVariant; registriesByFamily?: Map; }>; /** * Best-effort detection of the document's primary font family, used to choose a * substitute for auto-download. Prefers the document defaults' font — spelled * out or pointed at in the theme — then falls back to the most frequent run * font. A cheap regex over the XML: no need to fully parse for this hint. * * @param docx The `.docx` bytes. * @returns The detected family name, or `undefined` when none is found. */ export declare function detectDocxFontFamily(docx: Uint8Array): string | undefined;