modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Interface DrawBarcodeOptions

    Options for generateBarcode: the RenderOptions plus the symbology and sizing. generateBarcode differs from renderBarcodePNG in two defaults: quietZone is 4 modules for 'qr' and 'datamatrix' and 10 for every other type, and textValue is the encoded value.

    interface DrawBarcodeOptions {
        background?: number[];
        ecLevel?: "L" | "M" | "Q" | "H";
        fitHeight?: number;
        fitWidth?: number;
        foreground?: number[];
        moduleSize?: number;
        pdf417Columns?: number;
        pdf417EcLevel?: number;
        quietZone?: number;
        showText?: boolean;
        textValue?: string;
        type: BarcodeType;
    }

    Hierarchy (View Summary)

    Index
    background?: number[]

    Background colour as [r, g, b], each channel 0-255. Missing channels default to 255, so the default colour is white.

    ecLevel?: "L" | "M" | "Q" | "H"

    Error-correction level, used by 'qr' only (default 'M'). Other types ignore it.

    fitHeight?: number

    Target height in pixels for the symbol plus quiet zone; any showText caption is drawn below it. Applied like fitWidth; when both are set the smaller module size wins.

    fitWidth?: number

    Target width in pixels for the symbol plus quiet zone, a positive finite number. The module size becomes the largest whole number at which they fit, never below 1, so a too-small bound is exceeded; it replaces moduleSize.

    foreground?: number[]

    Foreground colour as [r, g, b], each channel 0-255. Missing channels default to 0, so the default colour is black.

    moduleSize?: number

    Pixels per module, a positive integer. Default 4.

    pdf417Columns?: number

    PDF417 output is not ISO/IEC 15438 conformant. Data columns 1-30 for 'pdf417' (default 4; values are truncated and clamped to the range; a non-finite value throws a RangeError).

    pdf417EcLevel?: number

    PDF417 output is not ISO/IEC 15438 conformant. Error-correction level 0-8 for 'pdf417' (default 2; values are truncated and clamped to the range; a non-finite value throws a RangeError).

    quietZone?: number

    Quiet zone around the symbol, in modules, a non-negative integer. Default 4.

    showText?: boolean

    Draw textValue as a caption below the symbol. Default false. The caption is skipped when textValue is empty.

    textValue?: string

    Caption text, drawn in a built-in 5x7 pixel font (letters are upper-cased; characters the font lacks render as a space). Default: empty, so no caption.

    The symbology to encode.