The TSPL/TSPL2 Programming Language is a set of commands for creating and printing labels or receipts. It has variety of commands that can be used to generate labels of any type or complexity. Some of the most commonly used commands include TEXT, BARCODE, and QRCODE.

PDF Manual

A complete list of available TSPL/TSPL2 commands can be found in the following "TSPL/TSPL2 Programming Language Manual" PDF files:




About TSPL/TSPL2

TSPL/TSPL2 is a command language used to control thermal label printers. These printers are commonly used for printing labels in various industries, such as logistics, retail, healthcare, and manufacturing.

TSPL/TSPL2 provides a set of commands that can be used to control the printer and customize the label layout, including text, barcodes, graphics, and other elements.

The commands in TSPL/TSPL2 can be sent to the printer from a computer or other device using various communication interfaces, such as USB, serial, Ethernet, or Wi-Fi. The printer then interprets the commands and prints the label accordingly.

Some common commands in TSPL/TSPL2 include setting label size and orientation, defining text and font attributes, specifying barcode symbologies and parameters, adding graphics and logos, and controlling the printing speed and darkness.

Simple example with JavaScript

Here is a simple example of how to print a label with text and barcode via JavaScript and WebUSB API:

async function print() {
  const cmds = [
    'SIZE 48 mm,25 mm',
    'CLS',
    'TEXT 20,10,"4",0,1,1,"TSPL/TSPL2"',
    'TEXT 20,50,"2",0,1,1,"Altynbek Usenbekov"',
    'BARCODE 20,80,"128",70,1,0,2,2,"altospos.com"',
    'PRINT 1',
    'END',
  ];
  
  const device = await navigator.usb.requestDevice({ filters: [] });
  await device.open();
  await device.selectConfiguration(1);
  await device.claimInterface(0);
  await device.transferOut(
    device.configuration.interfaces[0].alternate.endpoints.find(obj => obj.direction === 'out').endpointNumber,
    new Uint8Array(
      new TextEncoder().encode(cmds.join('\r\n'))
    ),
  );
  await device.close();
}