ComPDFKit Web SDK
    Preparing search index...

    Interface DocumentWatermarkOptions

    Watermark written to the file: either text or image (RGBA pixels, ImageData works); color '#rrggbb' (gray by default), opacity 0–1 (0.5 by default), rotation in degrees (45 by default); front true by default (over the content); with tiling, tiled over the whole page; pages are page numbers (all by default)

    interface DocumentWatermarkOptions {
        color?: string;
        fontName?: string;
        fontSize?: number;
        front?: boolean;
        horizontalAlign?: "left" | "right" | "center";
        horizontalOffset?: number;
        image?: { data: ArrayLike<number>; height: number; width: number };
        opacity?: number;
        pages?: number[];
        rotation?: number;
        scale?: number;
        text?: string;
        tiling?: { horizontalSpacing: number; verticalSpacing: number };
        verticalAlign?: "center" | "top" | "bottom";
        verticalOffset?: number;
    }
    Index
    color?: string

    Text color '#rrggbb'. Defaults to gray '#808080'.

    fontName?: string

    Font name. Defaults to 'Helvetica'.

    fontSize?: number

    Font size in points. Defaults to 48.

    front?: boolean

    Whether the watermark is drawn over the page content. Defaults to true.

    horizontalAlign?: "left" | "right" | "center"

    Horizontal alignment on the page. Defaults to 'center'.

    horizontalOffset?: number

    Horizontal offset in PDF points. Defaults to 0.

    image?: { data: ArrayLike<number>; height: number; width: number }

    Watermark image as RGBA pixels (an ImageData works). Give either this or text.

    Type Declaration

    • data: ArrayLike<number>

      RGBA pixel data, 4 bytes per pixel.

    • height: number

      Image height in pixels.

    • width: number

      Image width in pixels.

    opacity?: number

    Opacity from 0 to 1. Defaults to 0.5.

    pages?: number[]

    Page numbers (1-based) to apply to; all pages by default.

    rotation?: number

    Rotation in degrees. Defaults to 45.

    scale?: number

    Scale factor. Defaults to 1.

    text?: string

    Watermark text. Give either this or image.

    tiling?: { horizontalSpacing: number; verticalSpacing: number }

    Tiles the watermark over the whole page with this spacing in PDF points.

    Type Declaration

    • horizontalSpacing: number

      Horizontal space between tiles.

    • verticalSpacing: number

      Vertical space between tiles.

    verticalAlign?: "center" | "top" | "bottom"

    Vertical alignment on the page. Defaults to 'center'.

    verticalOffset?: number

    Vertical offset in PDF points. Defaults to 0.