/** * Zero-dependency text-to-PNG watermark image generator. * * Renders text into a semi-transparent PNG suitable for use as an Excel watermark. * Uses a built-in bitmap font for ASCII characters — no Canvas or external fonts required. * PNG data is deflate-compressed using the archive module's built-in compressor. * * @example * ```typescript * const png = createTextWatermarkImage("CONFIDENTIAL", { * fontSize: 48, * color: { r: 128, g: 128, b: 128 }, * opacity: 40, * rotation: -45 * }); * const imgId = workbook.addImage({ buffer: png, extension: "png" }); * worksheet.addWatermark({ imageId: imgId }); * ``` */ /** * Options for text watermark image generation. */ export interface TextWatermarkImageOptions { /** * Approximate font size in pixels (glyph height). * The built-in bitmap font is 8px tall; values larger than 8 are achieved by * integer scaling. e.g. fontSize 48 → 6x scale. * @default 48 */ fontSize?: number; /** * Text color as RGB (0-255 each). * @default { r: 128, g: 128, b: 128 } */ color?: { r: number; g: number; b: number; }; /** * Opacity as a percentage (0 = fully transparent, 100 = fully opaque). * * Note: this is a **0–100 percentage** used when rendering the PNG image pixels. * It is different from `WatermarkOptions.opacity` (which is 0–1) used by * `worksheet.addWatermark()` for DrawingML `alphaModFix`. * * @default 40 */ opacity?: number; /** * Rotation in degrees (positive = counter-clockwise). * @default -45 */ rotation?: number; /** * Padding in pixels around the text (before rotation). * @default 20 */ padding?: number; } /** * Generate a PNG image containing watermark text. * * The image has an alpha channel so the watermark is semi-transparent. * Works in both Node.js and browsers with zero dependencies. */ export declare function createTextWatermarkImage(text: string, options?: TextWatermarkImageOptions): Uint8Array;