Print ZPL

Print ZPL Command
v19.0

The printzpl Lava command allows you to send ZPL (Zebra Programming Language) instructions directly to a Zebra label printer. This is helpful when you need to generate and print labels (such as name badges, check-in labels, or custom tags) from within a Lava template.

The command captures the ZPL content inside the block and sends it to the specified printer for immediate printing.

For example:

{% printzpl deviceid:'12' %}
^XA
^FO50,50
^A0N,40,40
^FDHello, World at {{'Now' | Date:'M/d/yyyy hh:mm:ss'}}!^FS

^FO50,120
^BY2
^BCN,80,Y,N,N
^FD1234567890^FS
^XZ
{% endprintzpl %}

When this Lava renders, the generated ZPL is sent to the specified printer and the label is printed.


PrintZpl example print output

How It Works

The printzpl command does not render visible output to the page. Instead, it processes the enclosed ZPL markup and sends the final result to the selected printer. Lava merge fields can be used inside the ZPL to dynamically insert values.

Warning: The ZPL content is sent directly to the printer as provided. Invalid or malformed ZPL may result in unexpected label output or printer errors.

Parameters

Below is a complete list of the parameters that are available to the command.

Quick Links:

DeviceId

The Id, IdKey, or Guid of a configured Device in Rock that represents a Zebra printer.

  • Required: No (required if ipaddress is not provided)
  • Example: deviceid:'12'

IpAddress

The IP address of the Zebra printer. You may optionally include a port number.

  • Required: No (required if deviceid is not provided)
  • Example: ipaddress:'192.168.1.145'
  • Example with Port: ipaddress:'192.168.1.145:9100'

You must provide either deviceid or ipaddress. If both are provided, the deviceid will be used.

Example Using IP Address

{% printzpl ipaddress:'192.168.1.145:9100' %}
^XA
^FO50,50
^A0N,40,40
^FDHello {{ CurrentPerson.NickName }}!^FS
^XZ
{% endprintzpl %}