Select your printer model

Parameters are refined by the selected printer.

addBarcode method


Adds a barcode print command to the command buffer.

Syntax

 
addBarcode(data, type, hri, font, width, height);

Parameter

data

String

Description

String

Specifies barcode data as a string.

Use the following escape sequences to specify binary data which cannot be represented as a string:

String

Description

\xnn

Control code (set nn in hexadecimal)

\\

Back slash

type

Constant

Barcode type

BARCODE_UPC_A

UPC-A

BARCODE_UPC_E

UPC-E

BARCODE_EAN13

EAN13

BARCODE_JAN13

JAN13

BARCODE_EAN8

EAN8

BARCODE_JAN8

JAN8

BARCODE_CODE39

CODE39

BARCODE_ITF

ITF

BARCODE_CODABAR

CODABAR

BARCODE_CODE93

CODE93

BARCODE_CODE128

CODE128

BARCODE_CODE128_AUTO

CODE128 auto

BARCODE_GS1_128

GS1-128

BARCODE_GS1_DATABAR_OMNIDIRECTIONAL

GS1 DataBar Omnidirectional

BARCODE_GS1_DATABAR_TRUNCATED

GS1 DataBar Truncated

BARCODE_GS1_DATABAR_LIMITED

GS1 DataBar Limited

BARCODE_GS1_DATABAR_EXPANDED

GS1 DataBar Expanded

Barcode type

Description

UPC-A

If an 11-digit figure is specified, the check digit is automatically appended. If a 12-digit figure is specified, the 12th digit is used as the check digit but verification is not performed.

UPC-E

Specify 0 in the first digit.
Specify the manufacturer code in the 2nd to 6th digits.
Specify the item code in right justification in the 7th to 11th digits. The number of digits of the item code depends on the manufacturer code. Specify 0 in each unused data.
If an 11-digit figure is specified, the check digit is automatically appended. If a 12-digit figure is specified, the 12th digit is used as the check digit but verification is not performed.

EAN13

If an 12-digit figure is specified, the check digit is automatically appended.
If a 13-digit figure is specified, the 13th digit is used as the check digit but verification is not performed.

JAN13

EAN8

If an 7-digit figure is specified, the check digit is automatically appended.
If an 8-digit figure is specified, the 8th digit is used as the check digit but verification is not performed.

JAN8

CODE39

If the first character is * , this character is processed as the start character. Otherwise, the start character is automatically added.

ITF

The start and stop codes are automatically added. Addition and verification of the check digit are not performed.

CODABAR

Specify the start character ((A to D, a to d).
Specify the stop character ((A to D, a to d).
Addition and verification of the check digit are not performed.

CODE93

The start and stop characters are automatically added.
The check digit is automatically calculated and added.

CODE128

Specify the start character (CODE A, CODE B, CODE C).
The stop character is automatically added.
The check digit is automatically calculated and added.
To encode the following characters, specify the corresponding 2-digit code starting with { :

  • FNC1: {1
  • FNC2: {2
  • FNC3: {3
  • FNC4: {4
  • CODE A: {A
  • CODE B: {B
  • CODE C: {C
  • SHIFT: {S
  • {: {{

When specifying CODE C, specify the barcode data as the control code of the escape sequence.

CODE128 auto

The start character, check digit, and stop character are automatically added.

The character string added to make the overall width of the CODE128 symbol as mini-mum is automatically converted. In this function, there is no need to specify the code set, and the barcode is printed simply by entering the data to be converted to symbols.

Example) When entering numbers: "123", etc.

When entering alphabets: "ABCabc", etc.

Data from 0 to 255 (control codes and character codes) can be specified.

Since the overall width changes automatically, use this function after confirming that the barcode fits into the print area and is printed without any problem.

When using FNC1, etc., use CODE128 rather than CODE128 auto.

GS1-128

The start character, FNC1, check digit, and stop characters are automatically added.
To automatically calculate and add the application ID (AI) and the following check digit, specify "*" at the check digit position.
The application ID (AI) can be put in parentheses. The parentheses are used as print characters for HRI and not encoded as data.
A blank space can be inserted between the application ID (AI) and data. The blank space is used as print characters for HRI and not encoded as data.
To encode the following characters, specify the corresponding 2-digit code starting with { :

  • FNC1: {1
  • FNC3: {3
  • (: {(
  • ): {)
  • *: {*
  • {: {{

GS1 DataBar Omnidirectional

Specify a 13-digit product ID (GTIN) excluding the application ID (AI) and check digit.

GS1 DataBar Truncated

GS1 DataBar Limited

GS1 DataBar Expanded

The application ID (AI) can be put in parentheses. The parentheses are used as print characters for HRI and not encoded as data.
To encode the following characters, specify the corresponding 2-digit code starting with { :

  • FNC1: {1
  • (: {(
  • ): {)

hri

Constant

Description

HRI_NONE (default)

No printing.

HRI_ABOVE

Above the barcode

HRI_BELOW

Below the barcode

HRI_BOTH

Both above and below the barcode

font

Constant

Description

FONT_A (default)

Font A

FONT_B

Font B

FONT_C

Font C

FONT_D

Font D

FONT_E

Font E

width

Default: 3

Value

Description

Integer from 2 to 6

Specifies the width of a single module in dots.

height

Default: 162

Value

Description

Integer from 1 to 255

Specifies the height of the barcode in dots.

Return value

Return value

Object type

Printer object

Printer

HybridPrinter2 object

HybridPrinter2

Exception

Exception

Object type

Parameter " ... " is invalid

Error

Supplementary explanation

  • Specify the addBarcode method at the beginning of a line.
  • In the page mode, this method is executed at the current position with the lower-left dot of the barcode (except for HRI) as the reference point.
  • Specify a string in accordance with the type of the barcode specified in type. The barcode is not printed if the string specified in data does not match the barcode type specified in type.
  • The "CODE 128 auto" type of barcode can be specified when the printer is TM-m30II, TM-m30II-H, TM-m30II-NT, TMm30II-S, TM-m30II-SL, TM-m30III, TM-m30III-H, TM-m50, TM-m50II, TM-m50II-H, TM-T88VII, TM-L100, TM-P20II or TM-P80II.
 

Quick Access

  • [Name]
  • [Format]
  • [Range]
  • [Description]
  • [Notes]

Epson ePOS SDK includes patented or patent pending functions. The contents must not be disclosed to third parties.


Epson ePOS SDK for JavaScript

Jump to the top