import { PDFDocument } from 'pdf-lib'; import type { PDFFont } from 'pdf-lib'; /** Options controlling how `.txt` inputs are laid out. */ export interface TextOptions { /** Font size in points. Defaults to `11`. */ fontSize?: number; /** Page margin in points on all four sides. Defaults to `54` (0.75in). */ margin?: number; /** Line height as a multiple of the font size. Defaults to `1.35`. */ lineHeight?: number; /** * Override the bundled DejaVu Sans font with your own TrueType/OpenType * font bytes — e.g. to render CJK or emoji, which the default font does not * cover. Pass the raw font file contents. */ font?: Uint8Array | ArrayBuffer; } /** Maximum size of a single text input: 200 KB. */ export declare const MAX_TEXT_BYTES: number; /** * Greedily wrap a single logical line to `maxWidth`, breaking on spaces and * hard-breaking any single word that is itself wider than the line. * * Widths are tracked incrementally from the per-character cache above, so the * whole pass is linear in the line's length with no repeated font layout. */ export declare function wrapLine(line: string, font: PDFFont, size: number, maxWidth: number): string[]; /** * Render UTF-8 text as a multi-page US-Letter PDF. Explicit line breaks are * preserved (including CR, vertical tab and the Unicode line separators), a * form feed starts a new page, tabs expand to spaces, and long lines wrap to * the page width. * Characters absent from the font render as its fallback glyph rather than * throwing (use `options.font` for scripts the default font doesn't cover). * * @throws {PdfMergeError} when the input exceeds the 200 KB limit or the font * cannot be embedded. */ export declare function textToDocument(bytes: Uint8Array, index: number, options?: TextOptions): Promise;