import type { PdfSpec, ToolFont } from './pdfSpec.cjs'; import { type DesignDefaults } from './defaults.cjs'; import { type CustomFontGroup } from './fonts.cjs'; import type { PdfItemExporter, UnsupportedCode } from './types.cjs'; export interface DesignToPdfSpecOptions { /** Custom tools' PDF exporters, by tool slug (passed per call). */ customPdfExporters?: Record; /** The PDF title (accessibility). */ title?: string; /** The document language. */ language?: string; /** Where the tools' own images live (social icons). */ cdnBaseUrl?: string; /** * The design schema version these defaults and exporters follow; a design * saved at an older version is reported (`version`), since values older * editors stored may mean something else (the editor migrates them). */ schemaVersion?: number; /** * The tools' default values, merged under the design's values as the * editor does when it loads a design. Without them, values a design leaves * out fall back to CSS defaults. */ defaults?: DesignDefaults; /** * Fonts beyond the editor's built-in ones, as the editor takes them * (`unlayer.init({ fonts: { customFonts } })`): a label, a CSS stack and a * stylesheet URL each, alone or in groups (`{ label, options }`). Returned * in `fonts` when the design uses them. */ customFonts?: (ToolFont | CustomFontGroup)[]; } /** The tools CDN the editor's production builds use. */ export declare const DEFAULT_CDN_BASE_URL = "https://cdn.tools.unlayer.com"; export interface UnsupportedContent { /** Why it was left out or approximated. */ code: UnsupportedCode; /** The content type, or the container (`body`, `row`, `column`). */ tool: string; /** Where in the design: e.g. ['rows', 2, 'columns', 0, 'contents', 1]. */ path: (string | number)[]; detail: string; } export interface DesignToPdfSpecResult { spec: PdfSpec; /** * The fonts the spec's text uses that have a stylesheet: the editor's * built-in web fonts, `customFonts` and fonts the design stores with one. * Pass them to renderPdf, as the editor passes its fonts: * `renderPdf(spec, session, { fonts })`. Without them, those families are * drawn in the next font of their stack. */ fonts: ToolFont[]; unsupported: UnsupportedContent[]; } /** * Builds the PDF spec of a design (builder design JSON in document mode). * Page size and margins come from the design's document settings; the * header and footer are drawn when the design has them. */ export declare function designToPdfSpec(design: { body?: Record; counters?: Record; schemaVersion?: number; }, options?: DesignToPdfSpecOptions): DesignToPdfSpecResult;