ComPDFKit Web SDK
    Preparing search index...

    Interface BackgroundOptions

    Background: either color ('#rrggbb') or image (RGBA pixels, ImageData works); rotation in degrees, offset in pt; pages are page numbers (all by default)

    interface BackgroundOptions {
        color?: string;
        horizontalAlign?: "left" | "right" | "center";
        horizontalOffset?: number;
        image?: { data: ArrayLike<number>; height: number; width: number };
        opacity?: number;
        pages?: number[];
        print?: boolean;
        rotation?: number;
        scale?: number;
        verticalAlign?: "center" | "top" | "bottom";
        verticalOffset?: number;
        view?: boolean;
    }
    Index
    color?: string

    Background color '#rrggbb'. Give either this or image.

    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 }

    Background image as RGBA pixels (an ImageData works). Give either this or color.

    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 1.

    pages?: number[]

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

    print?: boolean

    Whether the background is printed. Defaults to true.

    rotation?: number

    Rotation in degrees. Defaults to 0.

    scale?: number

    Scale factor. Defaults to 1.

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

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

    verticalOffset?: number

    Vertical offset in PDF points. Defaults to 0.

    view?: boolean

    Whether the background is shown on screen. Defaults to true.