LPrint v1.0 - February 17, 2020 Copyright 2019-2020 by Michael R Sweet
LPrint is licensed under the Apache License Version 2.0 with an exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS). See the files “LICENSE” and “NOTICE” for more information.
LPrint is a label printer application for macOS® and Linux®. I wrote it in response to criticism that coming changes in CUPS will leave users of label printers in the cold - see CUPS Github issue #5271.
Basically, LPrint is a print spooler optimized for label printing. It accepts “raw” print data as well as PNG images (like those used for shipping labels by most shippers’ current web APIs) and has built-in “drivers” to send the print data to USB and network-connected label printers. The spooler also tries to keep the labels moving by merging jobs over a single connection to the printer rather than starting and stopping like CUPS does to support a wider variety of printers.
LPrint supports the full range of options and features supported by the embedded drivers - currently all Dymo and Zebra ZPL label printers. Whenever possible, LPrint will auto-detect the make and model of your printer and its installed capabilities. And you can configure the default values of all options as well as manually configure the media that is loaded in each printer.
LPrint also offers a simple network server mode that makes any label printers appear as IPP Everywhere™/AirPrint™ printers on your network. Thus, any macOS, iOS®, or Linux client can use any label printer supported by LPrint. And you can, of course, send jobs from LPrint to an LPrint server on the network.
Finally, LPrint offers command-line and web-based monitoring of printer and job status.
LPrint is published as a snap for Linux. Run the following command to install it:
sudo snap install lprint
A disk image is included with all source releases on Github for use on macOS 10.14 and higher.
If you need to install LPrint from source, you’ll need a “make” program, a C99 compiler (Clang and GCC work), the CUPS developer files, the PNG library and headers, and the LIBUSB library and headers. Once the prerequisites are installed on your system, use the following commands to install LPrint to “/usr/local/bin”:
./configure make sudo make install
The “configure” script supports the usual autoconf options - run:
to get a list of configuration options.
LPrint uses a single executable to perform all functions. The normal syntax is:
lprint SUB-COMMAND [OPTIONS] [FILES]
where “SUB-COMMAND” is one of the following:
You can omit the sub-command if you just want to print something, for example:
The options vary based on the sub-command, but most commands support “-d” to specify a printer and “-o” to specify a named option with a value, for example:
lprint -d myprinter labels.zpl: Print a file to the printer named “myprinter”.
lprint -o media=oe_xl-shipping-label_4x6in label.png: Print a shipping label image to a 4x6 label.
lprint default -d myprinter: Set “myprinter” as the default printer.
You can find our more about each sub-command by reading its included man page, for example the following command will explain all of the supported options for the “submit” sub-command:
The “add” sub-command adds a new printer:
lprint add -d PRINTER -v DEVICE-URI -m DRIVER-NAME
“PRINTER” is the name you want to give the print queue. Printer names can contain spaces and special characters, but if you do any printing from scripts you probably want to limit yourself to ASCII letters, numbers, and punctuation.
“DEVICE-URI” is a “usb:” or “socket:” URI for the printer. For USB-connected label printers, use the “devices” sub-command to discover the URI to use:
For network-connected printers, print the configuration summary on your label printer to discover its IP address. The device URI will then be “socket://” followed by the IP address. For example, a printer at address 192.168.0.42 will use the device URI “socket://192.168.0.42”.
Finally, the “DRIVER-NAME” is the name of the internal LPrint driver for the printer. Use the “drivers” sub-command to list the available drivers:
For example, the common 4-inch Zebra printer uses the “zpl_4inch-203dpi-dt” driver:
lprint add -d myprinter -v socket://192.168.0.42 -m zpl_4inch-203dpi-dt
The following options are supported by the “submit” sub-command:
Media sizes use the PWG self-describing name format which looks like this:
“CLASS” is “na” for North American media sizes, “oe” for other cut label sizes
in inches, “om” for other cut label sizes in millimeters, or “roll” for
continuous roll sizes in inches or millimeters. “NAME” is a string of letters,
numbers, dots (“.”), and dashes (“-“) describing the size. “WIDTH” and
“LENGTH” are the width and length of the label or receipt you want to print.
The trailing “in” or “mm” specifies the units in inches or millimeters,
respectively. For example, a 4x6” shipping label uses the size name
na_4x6-index_4x6in while a 1.25x3.5” address label uses
oe_address-label_1.25x3.5in and a 50x200mm receipt uses
2-up labels (where two labels are placed side-by-side) use the combined sizes
of both labels. For example, a 2-up 0.5x1” multipurpose label uses the size
You can get a list of supported values for these options using the “options” sub-command:
lprint options lprint options -d PRINTER
You can set the default values for each option with the “add” or “modify” sub-commands:
lprint add -d PRINTER -v DEVICE-URI -m DRIVER-NAME -o OPTION=VALUE ... lprint modify -D PRINTER -o OPTION=VALUE ...
In addition, you can configure the installed media and other printer settings using other “-o” options. For example, the following command configures the labels that are installed in a Dymo LabelWriter 450 Twin Turbo printer:
lprint modify -d Dymo450TT \ -o media-ready=oe_address-label_1.25x3.5in,oe_shipping-label_2.125x4in
Use the “options” sub-command to see which settings are supported for a particular printer.
The “server” sub-command runs a standalone spooler. The following options control the server operation:
When you run a standalone spooler on a network hostname, a web interface can be
enabled that allows you to add, modify, and delete printers, as well as setting
the default printer. Because all web interface operations require
authentication, you need to set the PAM authentication service with the
-o auth-service=SERVICE option. For example, to use the “cups” PAM service
with LPrint, run:
lprint -o server-name=HOSTNAME -o server-port=NNN -o auth-service=cups
By default, any user can authenticate web interface operations. To restrict
access to a particular UNIX group, use the
-o admin-group=GROUP option as
The following additional resources are available: