This guide explains how to print ZPL labels from different operating systems (Mac, Unix, and Windows) for labels processed through the CSV process. It also includes information on connecting a label printer to the API and automating the printing of shipping labels.
Printing ZPL labels from Mac/Unix
- Use the following command to find the printer name:
$ lpstat -p -d
- Use the printer name and the ZPL file name to send print jobs:
$ lpr -P <PRINTER_NAME> -o raw <FILENAME.zpl>
- If additional options are required, such as page size and margins, retrieve the printer-specific options using:
$ lpoptions -p PRINTER_NAME -l
Example command with options:
$ lpr -P PRINTER_NAME -o media=Custom.4x6in -o page-left=0 -o page-right=0 -o page-top=0 -o page-bottom=0 FILENAME.png
Zebra printers are easy to work with, as they typically require only the raw option to print ZPL files. For Dymo printers, more options may be necessary for proper formatting, such as specifying page size and margins.
Printing ZPL labels from Windows
- Ensure the appropriate drivers for the Zebra printer are installed on the Windows machine. These drivers can typically be found on the Zebra website or through the printer’s installation media.
- After installing the drivers, open Command Prompt and use the following command to send the ZPL file to the printer:
print /d:”\\<COMPUTER_NAME>\<PRINTER_NAME>” <PATH_TO_FILE.zpl>
Example
print /d:”\\DESKTOP-12345\Zebra_ZP450” C:\Users\User\Documents\label.zpl
Working with Windows requires a deeper familiarity with the printer libraries (C or C#), making automation more difficult. Multi-page labels on Dymo printers may require specially crafted PDFs or splitting PNG files to ensure proper formatting, as the default EasyPost format is intended for inkjet printers. It may be worth considering Zebra printers for larger-scale operations due to their ZPL format’s efficiency.
Connecting a Label Printer to the API
Each shipment object includes a postage_label string containing a label_url, which can be used to retrieve the label file. This file can be sent directly to a printer.
- Retrieve the label file from the label_url.
- Send the file directly to the printer using a raw print command, as outlined in the sections above for Mac/Unix or Windows systems.
See Tutorial: Printing with PrintNode for additional details
Automating Shipping Label Printing
Automating shipping label printing is easier on *nix (Linux, MacOS) systems than on Windows due to better compatibility with command-line printing utilities.
- Zebra Printers: Sending ZPL files directly via the command line using the raw option is simple, and multi-page label printing is straightforward due to the small size of ZPL files and carrier support for this format. For large-scale operations, Zebra printers, such as the GK or GX 420d models are highly recommended.
- Dymo Printers: Automating printing on Dymo printers requires more attention to details like page size, margins, and multi-page label handling. The best way to handle multi-page labels is by creating PDFs formatted specifically for the Dymo printer. This is an example of a PDF designed for printing on Dymo. Alternatively, PNG files can be split into multiple images and printed individually. However, this may introduce additional complexity compared to Zebra printers, which handle tasks more efficiently.
Printer Recommendations
For organizations experiencing friction with Dymo printers, investing in a Zebra GK or GX 420d may be a more scalable solution, especially for large-scale printing needs. Zebra printers support the ZPL format, which is highly efficient for moving and processing label files.