Zebra Programming Language (ZPL and ZPL II) is a page description language from Zebra Technologies. It is used primarily for labeling applications. The original ZPL was advanced to ZPL II, but a full compatibility with the older version is not given. Meanwhile, ZPL II is emulated by many label printers of various producers.

Later, the Zebra Basic Interpreter (ZBI) was integrated into printer software, which is seen as an advancement to ZPL II by the producer and is ANSI BASIC oriented. Primarily, it is intended to avoid a refactoring of code when changing the printer, if the old printer software was written by a label printer of a competitor. A possible use of ZBI could be for when the Zebra printer receives a foreign label format, which it would then convert to ZPL II on the fly so it can be printed.

Some printers also support the older Eltron Programming Language (EPL) for printers.

The Ax.pos.zebra package contains a fluent API to interact with ZPL printers.

1 Label

The Ax.pos.zebra.Label class provides a fluent api for most common ZPL instructions. In the following example we can see how to draw a label.

Copy
<script>

    // ==============================================================
    // http://labelary.com/viewer.html
    // ==============================================================
    
    var zebra = new Ax.pos.zebra.Label();
    zebra.changeFont("0", 60);
    zebra.addGraphicBox(50, 50, 100, 100, 100);
    zebra.addReverse();
    zebra.addGraphicBox(75, 75, 100, 100, 100);
    zebra.addGraphicBox(88, 88,  50,  50,  50);
    
    // ==============================================================
    // 1st
    // ==============================================================
    zebra.addComment("Top section with company logo, name and address.");
    
    zebra.addText(220,  50, "Intershipping, Inc.");
    zebra.changeFont("0", 30);
    zebra.addText(220, 115, "1000 Shipping Lane");
    zebra.addText(220, 155, "Shelbyville TN 38102");
    zebra.addText(220, 195, "United States (USA)");
    zebra.addGraphicBox(50, 250,  700,  1,  3);
    
    // ==============================================================
    // 2nd
    // ==============================================================
    zebra.addComment("Second section with recipient address and permit information.");
    
    zebra.changeFont("A", 30);
    zebra.addText( 50, 300, "John Doe");
    zebra.addText( 50, 340, "100 Main Street");
    zebra.addText( 50, 380, "Springfield TN 39021");
    zebra.addText( 50, 420, "United States (USA)");
    
    zebra.addComment("Permit box");
    
    zebra.changeFont("A", 15);
    zebra.addGraphicBox(600,300, 150,150,3);
    zebra.addText(638,340, "Permit");
    zebra.addText(638,390, "123456");
    zebra.addGraphicBox(50, 500,  700,  1,  3);
    
    // ==============================================================
    // 3rd
    // ==============================================================
    
    zebra.addComment("Third section with barcode.");
    
    zebra.addCode128(100,550,"12345678")
    .setBarCodeWidth(5)
    .setWideBarRatio(2)
    .setBarCodeHeigth(270);
    
    // ==============================================================
    // 4th
    // ==============================================================
    
    zebra.addComment("Fourth section (the two boxes on the bottom).");
    zebra.addGraphicBox( 50, 900, 700, 250,  3);
    zebra.addGraphicBox(400, 900,   1, 250,  3);
    zebra.changeFont("0", 40);
    zebra.addText(100, 960, "Ctr. X34B-1");
    zebra.addText(100,1010, "REF1 F00B47");
    zebra.addText(100,1060, "REF2 BL4H8");
    zebra.changeFont("0", 190);
    zebra.addText(470, 955, "CA");
    
    console.log(zebra.toZPL())
</script>
^XA
^MMT
^CF0,60
^FO50,50^GB100,100,100^FS
^FR^FO75,75^GB100,100,100^FS
^FO88,88^GB50,50,50^FS

^FX Top section with company logo, name and address. ^FS

^FO220,50^FH\^FDIntershipping, Inc.^FS
^CF0,30
^FO220,115^FH\^FD1000 Shipping Lane^FS
^FO220,155^FH\^FDShelbyville TN 38102^FS
^FO220,195^FH\^FDUnited States (USA)^FS
^FO50,250^GB700,1,3^FS

^FX Second section with recipient address and permit information. ^FS

^CFA,30
^FO50,300^FH\^FDJohn Doe^FS
^FO50,340^FH\^FD100 Main Street^FS
^FO50,380^FH\^FDSpringfield TN 39021^FS
^FO50,420^FH\^FDUnited States (USA)^FS

^FX Permit box ^FS

^CFA,15
^FO600,300^GB150,150,3^FS
^FO638,340^FH\^FDPermit^FS
^FO638,390^FH\^FD123456^FS
^FO50,500^GB700,1,3^FS

^FX Third section with barcode. ^FS

^BY5,2,270
^FO100,550^BCN,270,Y,N,N
^FD12345678^FS
^XZ

2 RFID

TO DO

This section is incomplete and will be concluded as soon as possible.

3 Wireless

TO DO

This section is incomplete and will be concluded as soon as possible.