zxing-wasm
    Preparing search index...

    Interface WriterOptions

    Writer options for writing barcodes.

    interface WriterOptions {
        addHRT?: boolean;
        addQuietZones?: boolean;
        ecLevel?: EcLevel;
        forceSquareDataMatrix?: boolean;
        format?: WriteInputBarcodeFormat;
        invert?: boolean;
        options?: string;
        readerInit?: boolean;
        rotate?: number;
        scale?: number;
        sizeHint?: number;
        withHRT?: boolean;
        withQuietZones?: boolean;
    }

    Hierarchy

    • Partial<Omit<ZXingWriterOptions, "format">>
      • WriterOptions
    Index

    Properties

    addHRT?: boolean

    Add human readable text (HRI) to the barcode.

    false

    addQuietZones?: boolean

    Add quiet zones around the barcode.

    true

    ecLevel?: EcLevel

    The error correction level of the symbol (empty string if not applicable)

    ""

    This option will be translated into options="ecLevel=<value>" and may be removed in the next major version. Use options instead.

    forceSquareDataMatrix?: boolean

    Force the Data Matrix to be square.

    false

    This option is translated into options="forceSquare". Use options instead.

    The format of the barcode to write.

    Accepted values are derived from barcodeFormat.ts (BCF) and include:

    • canonical format names,
    • human-readable labels from the table,
    • backward-compatible aliases (e.g. "rMQRCode").
    • Values are normalized by encodeFormat before being sent to C++.
    • The concrete writable set is zint-aware in this package build (w flag or non-zero zint id).

    "QRCode"

    invert?: boolean

    Invert the colors of the barcode.

    false

    options?: string

    Comma separated list of symbology specific options and flags.

    This string is parsed by the underlying C++ library to extract named parameters. For boolean flags, include the name (e.g., "gs1"). For options with values, use a key=value format (e.g., "version=5"). Multiple options can be combined, separated by commas (e.g., "gs1,version=2").

    Known keys used by CreatorOptions in the C++ backend:

    • eci: (string/integer) Specifies ECI designator.
    • gs1: (boolean) Enables GS1 encoding.
    • readerInit: (boolean) Sets reader-initialization / programming mode.
    • stacked: (boolean) Generates a stacked version for DataBar / DataBarExpanded.
    • forceSquare: (boolean) Only consider square symbol versions. Supported only for the DataMatrix format.
    • columns: (integer) Specifies number of columns (e.g., PDF417 / DataBarExpanded stacked).
    • rows: (integer) Specifies number of rows (e.g., PDF417 / DataBarExpanded stacked).
    • version: (integer) Specifies the version / size of most 2D symbols.
    • dataMask: (integer) Specifies the data mask pattern for QRCode / MicroQRCode.
    • ecLevel: (string) Error correction level / percentage where supported (e.g. L, M, Q, H, 30%).

    This field is forwarded directly to ZXing C++ CreatorOptions for parsing.

    ""

    readerInit?: boolean

    Set if this is the reader initialisation / programming symbol.

    false

    This option will be translated into options="readerInit" and may be removed in the next major version. Use options instead.

    rotate?: number

    Rotate the barcode by given degrees (0, 90, 180, 270).

    0

    scale?: number

    Scale factor for rendering, i.e. the module size. Passing a negative value will choose the scale automatically to fit the size of the barcode to abs(scale) as close as possible.

    1

    sizeHint?: number

    A size hint to determine the scale of the barcode. 0 means unset.

    This only takes effect if scale is unset.

    0

    This option is translated to scale = -abs(sizeHint) when scale is not provided. Use scale directly.

    withHRT?: boolean

    Legacy alias of addHRT.

    Only used when addHRT is not provided.

    false

    Use addHRT instead.

    withQuietZones?: boolean

    Legacy alias of addQuietZones.

    Only used when addQuietZones is not provided.

    true

    Use addQuietZones instead.