Search results

BarcodeGenerator API in JavaScript Barcode API control

Represents the Barcode control

<div id='barcode'/>
let barcode: Barcode = new Barcode({
width:'1000px', height:'500px' });
barcode.appendTo('#barcode');

Properties

backgroundColor

string

Defines the background color of the barcode.

Defaults to ‘white’

displayText

DisplayTextModel

Defines the text properties for the barcode.

Defaults to

enableCheckSum

boolean

Defines the checksum for the barcode.

Defaults to ‘true’

enablePersistence

boolean

Enable or disable persisting component’s state between page reloads.

Defaults to false

enableRtl

boolean

Enable or disable rendering component in right to left direction.

Defaults to false

foreColor

string

Defines the forecolor of the barcode.

Defaults to ‘black’

height

string | number

Defines the height of the barcode model.

<div id='barcode'/>
let barcode: Barcode = new Barcode({
height:'1000px', height:'500px' });
barcode.appendTo('#barcode');

Defaults to ‘100’

locale

string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

Defaults to

margin

MarginModel

Defines the margin properties for the barcode.

Defaults to

mode

string

Defines the barcode rendering mode.

  • SVG - Renders the bar-code objects as SVG elements
  • Canvas - Renders the bar-code in a canvas

Defaults to ‘SVG’

type

string

Defines the type of barcode to be rendered.

Defaults to ‘Code128’

value

string

Defines the value of the barcode to be rendered.

Defaults to undefined

width

string | number

Defines the width of the barcode model.

<div id='barcode'/>
let barcode: Barcode = new Barcode({
width:'1000px', height:'500px' });
barcode.appendTo('#barcode');

Defaults to ‘100%’

Methods

addEventListener

Adds the handler to the given event listener.

Returns void

appendTo

Appends the control within the given HTML element

Parameter Type Description
selector (optional) string | HTMLElement Target element where control needs to be appended

Returns void

dataBind

When invoked, applies the pending property changes immediately to the component.

Returns void

destroy

Destroys the barcode control

Returns void

exportAsBase64Image

Export the barcode as an image in the specified image type and returns it as base64 string. @param {BarcodeExportType} barcodeExportType - Defines the format of the barcode to be exported

Returns Promise

exportImage

Export the barcode as an image in the specified image type and downloads it in the browser. @param {string} fileName - Specifies the filename of the barcode image to be download. @param {BarcodeExportType} exportType - Defines the format of the barcode to be exported

Returns void

getModuleName

Returns the module name of the barcode

Returns string

getPersistData

Get the properties to be maintained in the persisted state.

Returns string

getRootElement

Returns the route element of the component

Returns HTMLElement

refresh

Applies all the pending property changes and render the component again.

Returns void

removeEventListener

Removes the handler from the given event listener.

Returns void

render

Renders the barcode control with nodes and connectors

Returns void

Inject

Dynamically injects the required modules to the component.

Returns void

Events

invalid

EmitType<Object>

Triggers if you enter any invalid character.