Welcome to the Industrial Automation website!

NameDescriptionContent
XING-Automation
E-mail  
Password  
  
Forgot password?
  Register
当前位置:

Zebra EPL2 Complete Guide

F: | Au:FANS | DA:2026-05-15 | 596 Br: | 🔊 点击朗读正文 ❚❚ | Share:

Zebra EPL2 Programming Complete Guide

Introduction: The positioning and advantages of EPL2

EPL2 (Eltron Programming Language 2) is the core page description language for Zebra desktop printers such as GK420, LP2844, G-Series, etc. Unlike the early line mode (EPL1), EPL2 adopts a "assemble first, print later" mechanism, which can efficiently process text, barcodes, graphics, and QR codes. Its syntax is concise and commands are compact, making it particularly suitable for quickly generating tags in resource constrained embedded environments.

This article is based on the official EPL Programming Guide (document number 14245L-003 Rev. A), which outlines common commands, form storage techniques, variable and counter usage, 2D barcode configuration, network settings (SGD), and common troubleshooting methods for engineers. It helps you quickly locate problems when developing or maintaining Zebra printing applications.


EPL2 Basic Concepts and Command Structure

2.1 Command syntax rules

Each EPL2 command starts with one or two case sensitive letters, followed by parameters (separated by commas), and ends with a line break (LF, ASCII 10). The carriage return (CR) will be ignored. The optional parts in the parameters are represented by square brackets, and the fixed data is enclosed in double quotation marks.

Example: A50,50,0,1,1,1, N, "Hello" - Print "Hello" at coordinates (50,50) using font 1, in normal orientation, without highlighting.

2.2 Image Buffer and Coordinate System

EPL2 uses a dot matrix coordinate system, with the origin (0,0) located in the upper left corner. The X-axis represents width, and the Y-axis represents height. All drawing commands (text, barcode, lines, boxes) are based on this coordinate system. Before printing, the image buffer must be cleared using the N command.

2.3 Media and Printing Control

Set label width (dots): q416 represents a width of 416 dots.

Q sets the label length and gap: Q160,24 represents 160 point labels+24 point gaps.

S sets the printing speed: S2 corresponds to 2 ips (inches/second), the specific value varies depending on the model.

D Set printing density: D5 range 0-15 (0 is shallowest, 15 is deepest).

P printing label: P1 prints one set, P2, Print 2 sets, with 3 copies per set.


Detailed explanation and practical skills of core commands

3.1 Text Printing - A Command

Command syntax: A p1, p2, p3, p4, p5, p6, p7, "DATA"

P1, p2: Starting coordinates (points)

P3: Rotation (0/1/2/3=0 °/90 °/180 °/270 °)

P4: Font selection (1-5 are built-in equal width Latin fonts; 8-9 are Asian double byte fonts; A-Z are soft fonts)

P5, p6: Horizontal/vertical magnification (1-6, 8, and 1-9)

P7: Normal (N) or reversed (R)

Tip: It is recommended to use the LE (Line Draw Exclusive OR) command to draw white text on a black background instead of the R parameter of the A command for more precise border control.

3.2 One Dimensional Barcode - B Command

The B command supports Code 39, Code 128, EAN/UPC, Interlocked 2 of 5, Codabar, Postnet, Planet, and more. The parameters include narrow bar width, wide bar width, barcode height, and whether to print readable characters.

Common problem: Barcode scanner cannot read barcodes in the "ladder" direction (rotated 90 °/270 °). Suggest using the "fence" direction (0 °/180 °) as much as possible. If rotating barcodes must be used, automatic optimization can be disabled through the oB command (but this may cause some scanners to fail to read, and Zebra does not guarantee compatibility).

Code 128 functional characters: Supports FNC1 – FNC4, automatically processes extended ASCII. For 5 or more consecutive extended characters, the printer automatically locks into extended mode; If there are less than 5, use the shift method.

3.3 Graphic Storage and Printing - GM/GG

GM "NAME" size: Download PCX format graphics to memory, size is in bytes. Binary data follows closely behind.

GG x, y, "NAME": Print stored graphics.

GW x, y, width, height, data: Directly write the original bitmap data into the image buffer (without storage).

Operation suggestion: Use DOS COPY/b command or Zebra Firmware Downloader to send graphic files. Do not add extra line breaks after graphic data.

3.4 Tables and Lines

LO x, y, width, height: Draw a black solid rectangle (covering existing content).

LW x, y, width, height: Draw a white rectangle (erase).

LE x, y, width, height: XOR line drawing can be used to invert existing graphics.

Form storage and automation of variables/counters

4.1 Form Concept

EPL2 allows storing complete label designs as "Forms". The form can contain fixed elements, variable fields, and counters, and can be printed by filling in variables each time it is called. This greatly reduces the overhead of duplicate data transmission.

Storage process:

FS "FORMNAME" - Start storing the form.

Define variables (V00,10, N, "Prompt"), counters (C0,5, L,+1, "-"), then add commands such as A/B and reference these variables.

FE - End storage.

Call process:

FR "FORMNAME" - Recall the form from memory.

Command followed by variable values (in defined order).

P1 printing.

4.2 Variables (V command)

Vnn, max, justification, "prompt" defines a variable field, where nn ranges from 00 to 99 and max is the maximum number of characters. Reference through Vnn in text or barcode data.

Expression support: A100200, 0, 4, 1,1, N, "Oil change at" V00+3000 "miles." can perform addition operations (only supports constant and variable addition). If the result exceeds the field length, fill in "X".

4.3 Counter (C command)

Cn, digits, justification, step, "prompt" define automatic up/down counters (only numbers are supported). The step size is+1 to+9 or -1 to -9. Use as an additional variable when the step size is+0.

Protecting consecutive numbers: Adding a minus sign - in front of the prompt can make the prompt only appear once when the form is recalled, and then automatically use the last value and increment it to prevent duplicate printing of the same serial number.


Advanced configuration of 2D barcode

EPL2 supports two-dimensional barcodes such as Aztec, Data Matrix, MaxiCode, PDF417, QR Code (Japanese models), etc., all of which use the b command, but the third parameter is different (A is Aztec, D is Data Matrix, M is MaxiCode, P is PDF417, Q is QR Code).

5.1 PDF417 Automatic Optimization

b x,y,P,max_width,max_height,sN,cM,xW,yH,rR,lC,tT,oR,"DATA"

Set the error correction level (s0-s8, default automatic).

Choose compression mode (c0 automatic, c1 binary).

X module width (dots, 2-9), y module height (4-99, default 4 x width).

Maximum number of rows for r and maximum number of columns for l.

The printer will automatically adjust the module size and number of rows/columns to fit the maximum size limit.

Common error: When the amount of data is too large to fit, error 93 (PDF-417 coded data too large) will be reported. The maximum width/height should be increased or the error correction level should be raised.

5.2 MaxiCode Mode Selection

MaxiCode supports modes 2, 3, 4, and 6. If not specified, the printer automatically selects mode 2 for all digits and mode 3 for alphanumeric characters based on the postal code. The data format for Mode 2/3 is: [)><RS>01<GS>zip<GS>country<GS>class<GS>tracking<GS>..., where<RS>=0x1E,<GS>=0x1D. The printer can automatically parse the AIM standard format.

5.3 Geometric Shape of Data Matrix

B x, y, D, cC, rR, hH, "DATA" where C specifies the number of columns and R specifies the number of rows. If not specified, the printer automatically selects the smallest square. If only columns (such as 18, 26, 32, 36, 48) or rows (8, 12, 16) are specified, rectangular symbols may be generated. When the data length is incompatible with the geometric shape, error 03 (Data Length Error) is reported.


Asian fonts and multilingual support

Asian models (Chinese, Japanese, Korean) support dual byte font 8 (24 × 24 dots @ 203 dpi, 36 × 36 @ 300 dpi) and font 9 (Traditional Chinese/Japanese). Single byte Latin fonts are retained simultaneously.

Use the 'i' command to set the spacing between Asian characters: i3 adds 3 spaces between characters.

Japanese JIS input: Use Shift (1C hex) plus&to enter JIS mode, Shift. to exit.

Code page switching: I8,0001 select American English (Code Page 437). The appendix lists various code pages (437, 737, 850, 852, 855, 857, 860, 861, 862, 863, 865, 866, 869, 1250-1255) and Asian double byte code pages.

Practical reminder: When changing languages, the corresponding firmware version must be used (such as Simplified Chinese, Japanese, and Korean are not compatible with each other). Switching code pages through the I command only affects Latin fonts (1-5) and does not affect double byte fonts 8/9.

SGD Command: Network and Device Configuration

The SGD (Set/Get/Do) command allows for dynamic configuration of printers through serial ports, USB, or Ethernet. They are! Starting with U1, the format is! U1 getvar "attribute" or!  U1 setvar "attribute" "value"。

7.1 Common Configuration Items

Example values for attribute description

The current programming language for device. languages is epl_zpl, which supports both EPL and ZPL

Media.printmode Printing modes: tea off ("T"), peel off ("P"), cutter ("C")

Ip.primary_network main network interface wired or wireless

Ip.dhcp.enable DHCP switch on/off

Ip.addr static IP address "192.168.1.100"

WLAN.ESSID wireless network name "Zebra_SIP"

The security types "none", "wep 40 bit", "wpa psk", etc. for wlan.security

Odometer.otal_print_1ength The total print length of the printer (read-only) returns "12345 INCHES, 31356 CENTIMETERS"

Debugging tips: Use! U1 getvar "ip.active_network" to check if the current connection is wired or wireless. If wireless association fails, check wlan.associated and wlan.signal_strength.

7.2 Batch Sending SGD Commands

Can be omitted! U1 prefix, end with END:

text

! U getvar "ip.telnet.enable"

getvar "ip.dhcp.enable"

END


Common faults and diagnostic methods

8.1 Dump Mode

Send the dump command to put the printer into dump mode. All data received afterwards will be printed in hexadecimal and ASCII format for checking the actual byte sequence sent to the printer. Press the feed button to print multiple pages, and then press the feed button to exit the dump mode.

Application scenario: When the label output does not match expectations, first enter dump mode, print a page, and observe whether the data contains unexpected control characters (such as extra line breaks, NUL, etc.), especially baud rate errors or XON/XOFF interference in serial communication.

8.2 Error Report

US Enable Error Report: When an error occurs, the serial port returns NACK (0x15) and an error code.

^Ee immediately returns an error status (4 bytes).

Common error codes: 07 (missing paper or tape), 08 (duplicate name), 09 (name not found), 11 (print head lifted), 84 (AutoSense failed).

Solution suggestion: Automated applications should regularly poll ^ ee or enable US to obtain real-time information on paper shortage status to avoid losing print tasks.

8.3 AutoSense and Media Detection

The xa command executes AutoSense to automatically calibrate sensors and set gap/black label parameters, but does not print configuration labels. If the printer's paper feed is inaccurate after replacing the medium, execute xa once. For continuous paper (without gaps), manually set the Q command and set the second parameter to 0.

8.4 Print Head Life Reminder (G-Series and 2746e)

Enable print head lifespan reminder for oLY, disable for oLN. OL [threshold, freq, "message"] Customize reminder thresholds (in kilometers), reminder frequencies (every N tags), and custom messages. URR prints the current status, while URH prints the print head history. These features help develop preventive maintenance plans.


Performance optimization and memory management

9.1 Dual Buffer Mode

RN disables double buffering, rY re enables it. Double buffering allows for the preparation of the next image while printing the previous label, improving throughput. But when the label width is small and there is not enough memory, the printer will automatically disable it. You can check the configuration through the U command to confirm if it is in a double buffering state.

9.2 Memory Allocation

The M command (for older firmware only) sets the memory size of the form. Modern Flash printers automatically manage memory, but users should still pay attention to:

EI lists soft fonts, EK "*" removes all soft fonts.

GI lists graphics, GK "*" deletes all graphics.

FI lists the forms, FK "*" deletes all forms.

Frequent deletion/storage will consume Flash write life, so try to reuse forms/graphics as much as possible.

9.3 Accelerate Printing Speed

Use S to select the appropriate printing speed (too high may cause barcode deformation).

Use D to adjust the concentration and avoid excessive heating.

Try to reduce the size of the image buffer as much as possible: when q is set small, double buffering is easier to take effect.

Use JB/JC/JF to control the "header top rollback" behavior to avoid unnecessary paper feeding/unloading actions.


Upgrading and replacement precautions

If upgrading from old models (such as Eltron early printers) to Zebra G-Series or 2844, please note:

Command compatibility: EPL2 commands are basically the same, but some options (such as the P option in the O command) may be different. Suggest printing configuration labels (U) on the new printer to confirm the firmware version.

Serial port settings: default 9600, N, 8,1. After using the Y command to make changes, the printer automatically resets and the host must synchronize the changes.

Line mode switching: Some models support EPL1 line mode, which can be switched by pressing the paper button when powered on, or by sending OEPL1 (later switched back to ESC EPL2).

Windows driver: Zebra universal printer driver supports sending EPL commands directly. In the Driver Properties → Printer tab → Tools, you can open the "Direct Command Input" window and test each command one by one.

  • Alcatel-Lucent 9500 MPR ODU Outdoor Unit 300 11GHz TX Low HP 3DB23035AAAA01
  • Alcatel-Lucent ECNT-C 3FE25676 BA AK 06 Termination Card
  • Alcatel Lucent MDR-8000 Microwave Digital Radio MDR-8606-45 with 13 Modules
  • Alcatel-Lucent 849144415 KS-24829L1 Remote Radio Head v1.4
  • Alcatel CFF 450 Turbo Pump Controller 137171
  • Alcatel-Lucent ACS108 109579896 004 Access Controller
  • Alcatel-Lucent OS6850-48 Network Switch with PS-126W-AC Power Supply
  • Alcatel Lucent DFP-CM-14B/2T Filter DCMA Base Station
  • Alcatel Lucent ESX-K100C32W4 ESXK100C32W4 Power Supply Module
  • Alcatel Lucent 91-E03100-A 91E03100A Interface Module
  • Alcatel-Lucent STGR-LIM-A2P-72-HBI ADSL2+ High Bandwidth Module
  • Alcatel-Lucent 9500 Microwave Packet Radio MPT-3DB20547BBAA02
  • Alcatel Lucent Enterprise 4049-4059 MMK Keyboard Console Kit
  • Alcatel-Lucent RRH4X40-1900 Remote Radio Head
  • Alcatel Lucent OS6450-P48 Switch
  • Alcatel Lucent 625617-000-001 Cable Assembly
  • Alcatel Lucent 108320 Module
  • Alcatel Lucent TN801B Board
  • Alcatel-Lucent RRH2X50-800 LTE Remote Radio Head
  • Alcatel Lucent CPU8 Board 3BA23258AB OmniPCX 4400
  • Alcatel-Lucent 3EM22617AAAE 9500 MPT-HL Microwave Radio Transceiver
  • Alcatel-Lucent CPU7-2 3BA23259AAAD 7750 SR Control Processor Module
  • Alcatel-Lucent 9500 Microwave Packet Radio MPT-3DB20371BCAA01
  • Alcatel-Lucent Enterprise 4059 MMK Keyboard + Phone PAC Kit
  • Alcatel-Lucent Nokia 3HE10329AA 7750 SR Series Router Module
  • Alcatel-Lucent 7705 SAR-W IP MPLS Service Aggregation Router 3HE07349AA
  • Alcatel-Lucent-Nokia 3HE08429AARC01 7750 SR SFM5-7 Switching Module
  • Alcatel-Lucent 3HE00272DB 7750 SR-7 DC Chassis with PEM3+EFT
  • Alcatel-Lucent ACT 1300M/1600M HT Turbo Pump Controller
  • Alcatel Lucent IMM48-1GB-TX 3HE03625AAG01 48-Port 7750 SR-12 Interface Module
  • Alcatel-Lucent AP-500 Wireless Access Point
  • Alcatel-Lucent ATP-150 Power Supply
  • Alcatel-Lucent 622-8603-012 Optical Transceiver
  • Alcatel-Lucent 270-0038-010 10.5 VDC Power Supply
  • Nokia 9500-MPR Microwave Radio Module XPIC-RPS/3DB20116BCAA01
  • Alcatel-Lucent 3DB19017AB EAS Access Switch v2
  • Alcatel-Lucent 3AL81072AA Matrix Enhanced Unit - Cross-Connect Module
  • Alcatel-Lucent MDR-8606-135 6GHz Digital Microwave Radio
  • Alcatel-Lucent 3EM09626AD RF Transmitter - MDR-8000 Component
  • Alcatel 3HE03619AAAF01 Network Module
  • Alcatel-Lucent 3EH76027AEJC OmniPCX Enterprise Communication Server
  • Alcatel-Lucent 9500 MPR 11GHz Microwave Link - 3DB22001DA
  • Alcatel-Lucent GSX-FM-4W - Gigabit Ethernet Fiber Module 4-Port
  • Alcatel-Lucent 270-0038-020 - Power Supply Interface Module
  • Alcatel-Lucent LNW64 - Network Processor Module for Switching Systems
  • Alcatel-Lucent 3DB19017AB - High-Density Interface Module Board
  • Valmet U4600063 - Industrial Automation Module
  • Valmet M851040 M1 MEMU Module - Memory and Expansion Unit
  • Metso Valmet A413016 NCU2 Board - Network Control Unit Model 17
  • Valmet A413115 TCU41 Board Ver.06 - Temperature Control Unit
  • Metso Valmet PEFT A413792 - Power Supply Module for Automation Systems
  • Valmet ABTU M2512201 - Analog Binary Termination Unit Module
  • Valmet ABMB MT036 PCB Card - Auxiliary Backplane Motherboard
  • Valmet A413345 FPUS Battery Backup Unit - Standby Power Module
  • Valmet A413060 DMU Rev 04 - Drive Monitor Unit Board
  • Valmet BOR82 A413292 - Binary Output Relay Module
  • Valmet A413383 Ver.04 ESW - Electronic Switching Module Board
  • Valmet Neles A415579 Valve Controller
  • Metso Valmet A413381 ESW Drive Board
  • Valmet ABTU Module 545266-2A 2-545264-2B - Analog Binary Termination Unit
  • Valmet ABMB MT838 PCB - Backplane Bus Mother Board
  • Valmet LEV-EL PG4 N1 H2S Sensor - 600mbar Gas Detector
  • Valmet ABMB MT940 PCB - Analogue Bus Mother Board Backplane
  • Valmet VAT65425921A MT241 PCB Board
  • Valmet A413310 VPU Power Unit - 230VAC 1.5A Automation Supply
  • Valmet Metso IOP303 Input Module 181504 - 32-Channel Digital Input
  • Valmet A413060 DMU Rev 07 - Data Management Unit
  • Valmet M851220 M1 PCB Card - Process Automation Interface Board
  • Valmet A413042 Ver.06 CPU
  • Valmet A413200-01 AIU 8 Analog Input Module
  • Basler DECS-250-CGCM-LN2SA1C Digital Excitation Control System
  • Valmet Automation PLC Module A413171
  • Valmet Automation 542852-3A Rack-Mount Cross Connect Panel
  • Valmet Marine Damatic M851565 Main Keyboard
  • Valmet TIU 6 Printed Circuit Board A413110
  • Metso Valmet U4440253V1.1 RMI CPU 300
  • Metso Valmet A413016 Ver.12 NCU2
  • Valmet M851565 Damatic Keyboard
  • Valmet ATB16-4 16 Channel Relay Card
  • Valmet Metso A413331 SPU Power Supply
  • Valmet PUD 10B Automation Control Rack
  • Valmet MT917 ABMB DMU PCB I/O Module
  • Valmet M851565 Damatic Keyboard Mkb2
  • Valmet EDS-518A-MM-SC Ethernet Gateway
  • Valmet 542836-6A PCB Card
  • Valmet ATB16-4/2 Terminal Board 9144047
  • Valmet ATB16-4 Controller Board 0-50°C 4-20mA Analog Output
  • Valmet 542852-3A Slot Rack Chassis Module
  • Valmet A413026 Ver.M1 FBC Board
  • Valmet IQ Basis Weight SH Sending Assembly A418081
  • Valmet PMB 2R Monolithic Backplane 8-Slot PCB 542821-5A and -5B
  • Valmet ATB16-4 16-Channel Relay Card Controller Board 22195028
  • Valmet Diff-EL SL6NK227SF0 Pressure Transmitter 0-380 mBar
  • Valmet A413110 TIU6 Board Ver.M1
  • Neles Automation A413278 Control Module
  • Valmet BCUTB Terminal Module 10101006 11091002
  • Valmet Senso 160 Measuring Station Display 160.2
  • Valmet AIU 1A Analog Input Unit M851245
  • Valmet IQ Web Caliper Sensor A420734
  • Valmet M851040/M8510401 Memory Board
  • Valmet AN35S1MC02RA Valve
  • Valmet M851121 M2 Cross Connect Panel
  • Valmet AIU-8 Simulator Board 421522-1A
  • Metso BIU 82 D200533 Binary Input Unit
  • Valmet M851121 M2 Module Rack
  • Valmet A413383 PC Board Module
  • Valmet N0542 NO54 ABMB PCB - 545200-3A Board
  • Valmet Metso IOP304 Input Module 181503
  • Valmet PDP601 Distributed Processing Unit 181585
  • Valmet A413084 CPU Board - Processor Module for Automation Systems
  • Valmet AIU 16T Analog Input Module M8512081 M1
  • Valmet AIU 16 Analog Input Module 545100-3A and 545100-3B
  • Metso Valmet BIU4 A413146 Binary Input Unit
  • Valmet AIU-8 Simulateur Board 421522-1a Analog Simulator
  • Valmet BIU8A Binary Input Unit 542803-3B M851222 M1
  • Valmet IQ Web Color DH Photoelectric Sensor A418182 2.04
  • Valmet A413200 AIU-8 Simulator Board 191151 421522-1A
  • Valmet Automation SCU M851006 System Control Unit Module
  • Valmet 857565/851565 Damatic Keyboard IP40 5V Operator Interface
  • Valmet A413077 FBC2 Module Rev 06 Field Bus Controller
  • Valmet DMU 2 PCB Module 545142-3A DM Data Management Unit
  • Valmet AIU16T PCB Card M851208 Analog Input Module
  • Valmet A413181 PLU Board
  • Valmet m851006 SCU Module
  • Valmet Metso 181226 Digital Input Module
  • Valmet AIU16T Analog Input Module - 16-Channel 65421466-2B MT924 V1.3
  • Valmet WIN3136875 Slide Clutch
  • Metso Valmet TIU61 A413111 Temperature Input Unit