BlogRSS Feed

Sawyer Bateman

How to Print Shipping Labels

by Sawyer Bateman

In general, we've had much better luck automating printing on *nix systems - communicating with the printer in Windows is difficult unless you're used to working with the Windows printer libraries directly in C or C#. On Mac, you should be able to use the command line to send print jobs:

$ lpstat -p -d

This will give you a list of attached printer names that you can use with subsequent commands. The Zebras are extremely easy to use, usually you send them .zpl files instead of images directly with the raw option. We're not sure if that's required when sending images to the Dymo but it looks like:

$ lpr -P PRINTER_NAME -o raw FILENAME.zpl

Our hunch is that the Dymo requires a lot more options to work correctly, at least page size and margins. To get the printer specific options you can run:

$ lpoptions -p PRINTER_NAME -l

And the command might end up looking something like this depending on the options it lists:

$ 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

Things are going to get a little trickier for multi-page labels with the Dymo - we've heard that the best way to pass multi-page files to it is via PDF. However, our default PDF format isn't suitable, it's meant for inkjet printing. The ideal PDF would be formatted more like this:

http://easypostdev.s3.amazonaws.com/postage_labels/labels/gosrA2.pdfopens in new tab

That's a 4x7 DHL label, but you get the idea, the PDF specifies for the Dymo where the page boundaries are, so you may have to craft suitable PDFs before printing if you're going to be doing international with multiple labels. There are other options, like splitting the EasyPost PNGs into multiple PNGs after you download them and sending them individually.

In our experience, the Zebra is a much easier printer to work with at scale. The ZPL label files are tiny to move around (it's an ASCII format), the carriers support them natively, and multi-page printing is a cinch. If you have significant friction with the Dymo it may be worth considering an investment in a Zebra GK or GX 420d.