Options

symbology

The enumerated type of the symbology (see Reference for a list).

fileName

Full path to the file to create.

text

Human-readable text to display.

  • Type: string
  • Required: no
  • Default value: the input data value

primary

Primary message data, for more complex symbols.

  • Type: string
  • Required: no
  • Default value: null

showHumanReadableText

If true, shows text underneath a barcode (if the symbology supports it). If false, text will not show.

  • Type: boolean
  • Required: no
  • Default value: true

foregroundColor

Barcode foreground color. Supports alpha channelsopen in new window.

  • Type: string
  • Required: no
  • Default value: FFFFFFFF

backgroundColor

Barcode background color. Supports alpha channelsopen in new window.

  • Type: string
  • Required: no
  • Default value: 000000FF

encoding

The encoding type of the input data, if applicable.

  • Type: EncodingMode
  • Required: no
  • Default value: EncodingMode.DATA_MODE

eci

The ECI encoding modeopen in new window of the input data, if applicable.

  • Type: number
  • Required: no
  • Default value: 0

height

The height of the image, in pixels. If specified, this will maintain the aspect ratio.

  • Type: number
  • Required: no
  • Default value: 50

whitespaceWidth

The width of whitespace, for barcodes which have this option.

  • Type: number
  • Required: no
  • Default value: 0

borderWidth

The width of the border.

  • Type: number
  • Required: no
  • Default value: 0

scale

Scale of the barcode image. Applies only to PNG.

  • Type: number
  • Required: no
  • Default value: 1.0

rotation

The clockwise rotation of the SymbologyType.

  • Type: number
  • Required: no
  • Default value: 0
  • Valid values: 0, 90, 180, 270

dotSize

Size of dot used in BARCODE_DOTTY_MODE.

  • Type: number
  • Required: no
  • Default value: 0.8

outputOptions

Symbology-specific output options.

option1

Symbology-type-specific option value.

  • Type: number
  • Required: no
  • Default value: null

option2

Symbology-type-specific option value.

  • Type: number
  • Required: no
  • Default value: null

option3

Symbology-type-specific option value.

  • Type: number
  • Required: no
  • Default value: null

Output Options

The outputOptions key in the SymbologyConfig object can be used to adjust various aspects of the rendered symbology.

ValueEffect
BARCODE_NO_ASCIINo options selected. (default)
BARCODE_BINDBoundary bars above and below the symbol and between rows if stacking.
BARCODE_BOXAdd a box surrounding the symbol and whitespace.
READER_INITAdd a reader initialisation symbol to the data before EncodingMode.
SMALL_TEXTUse a smaller font for the human readable text.
BOLD_TEXTEmbolden the human readable text.
CMYK_COLOURSelect the CMYK colour space option for encapsulated PostScript files.
BARCODE_DOTTY_MODEPlot a matrix symbol using dots rather than squares.
GS1_GS_SEPARATORUse GS instead FNC1 as GS1 separator.

Multiple Options

Options can be applied using the OutputOption enumerated type.

Multiple options can be selected by adding them together in the outputOptions value.

Deprecation Notice

Starting in version 2.1.0, the Options enum has been renamed to OutputOption, and Options will be removed in the next major release.

Example

import {
  OutputOption,
  OutputType,
  SymbologyType,
  createStream
} from 'symbology'

createStream({
  symbology: SymbologyType.CODE128,
  outputOptions: OutputOption.BARCODE_BIND + OutputOption.READER_INIT
}, '12345', OutputType.PNG)