POSBarcode provides an api to generate ESC/POS barcode sequences. Those sequences can be send directly to a POS printer or can be used as part of more complex documents using POSPrinter api.

The class uses ESC/P sequences. ESC/P, short for Epson Standard Code for Printers and sometimes styled Escape/P, is a printer control language developed by Epson to control computer printers. It was mainly used in dot matrix printers and some inkjet printers, and is still widely used in many receipt thermal printers.

1 Barcode

You can generate the sequence of bytes for a barcode by using the following syntax.

var bytes = new Ax.pos.POSBarcode("UPCA")

Barcode types
Type Description
UPCA The Universal Product Code (UPC) (technically refers to UPC-A) consists of 12 numeric digits that are uniquely assigned to each trade item.
UPCA_B UPC-B is a 12-digit version of UPC with no check digit, developed for the National Drug Code (NDC) and National Health Related Items Code. It has 11 digits plus a 1-digit product code
UPCE_A UPC-E is a 6-digit code, that has its equivalent in UPC-A 12-digit code with number system 0 or 1.
UPCE_B UPC-E is a 6-digit code, that has its equivalent in UPC-A 12-digit code with number system 0 or 1.
EAN13_A The EAN-13 was developed as a superset of UPC-A, adding an extra digit to the beginning of every UPC-A number. This expanded the number of unique values theoretically possible by ten times to 1 trillion. EAN-13 barcodes also indicate the country in which the company that sells the product is based (which may or may not be the same as the country in which the good is manufactured). The three leading digits of the code determine this, according to the GS1 country codes. Every UPC-A code can be easily converted to the equivalent EAN-13 code by prepending 0 digit to the UPC-A code. This does not change the check digit.
EAN13_B ...
EAN8_A EAN-8 is an 8-digit variation of the EAN barcode.
CODE39_A Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is a variable length, discrete barcode symbology.
CODE39_B ...
CODE93 Code 93 is a barcode symbology designed in 1982 by Intermec to provide a higher density and data security enhancement to Code 39. It is an alphanumeric, variable length symbology. Code 93 is used primarily by Canada Post to encode supplementary delivery information. Every symbol includes two check characters.

Each Code 93 character is nine modules wide, and always has three bars and three spaces, thus the name. Each bar and space is from 1 to 4 modules wide. (For comparison, a Code 39 character consists of five bars and four spaces, three of which are wide, for a total width of 13–16 modules.)

Code 93 is designed to encode the same 26 upper case letters, 10 digits and 7 special characters as code 39

CODE128 Code 128 is a high-density linear barcode symbology defined in ISO/IEC 15417:2007.[1] It is used for alphanumeric or numeric-only barcodes. It can encode all 128 characters of ASCII and, by use of an extension symbol (FNC4), the Latin-1 characters defined in ISO/IEC 8859-1.

2 QRCode

QR code (abbreviated from Quick Response code) is the trademark for a type of matrix barcode (or two-dimensional barcode) first designed in 1994 for the automotive industry in Japan. A barcode is a machine-readable optical label that contains information about the item to which it is attached. In practice, QR codes often contain data for a locator, identifier, or tracker that points to a website or application. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently; extensions may also be used.

var bytes = new Ax.pos.POSQRCode()
    // The size of module in dots (1 to 16, default = 3).
    // The error correction level (L:7%, M:15%, Q:25%, H:30%), default if not set is M
    // the information to encode
    .print("Please don’t try to scan this one");

3 PDF417

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management. "PDF" stands for Portable Data File. The "417" signifies that each pattern in the code consists of 4 bars and spaces in a pattern that is 17 units (modules) long.

var bytes = new Ax.pos.POSPDF417()
    // The width and height of module in dots (2 to 8, recomended 3 to 5).
    .setSize(3, 3)
    // The error correction level L0 to L8, default if not set is L1
    // the information to encode