Skip to content

Instantly share code, notes, and snippets.

@gjoseph92
Last active November 28, 2023 17:32
Show Gist options
  • Save gjoseph92/5a92c667b97c375029ca2478601cce84 to your computer and use it in GitHub Desktop.
Save gjoseph92/5a92c667b97c375029ca2478601cce84 to your computer and use it in GitHub Desktop.
Notes on printing better quality labels using LPrint

The built-in driver for the Zebra LP2844 on macOS ("Zebra EPL2 Label Printer", see https://youtu.be/DT6gnpzzU60) gives pretty crappy print quality.

The latest (unreleased, as of Aug 2023) version of LPrint does better, see michaelrsweet/lprint#91 (comment).

I think the new "special algorithm" doesn't actually do much. It may just be that print-color-mode=bi-level, aka Print Mode: Text (which thresholds the image instead of trying to use dithering to cover the whole grayscale range) wasn't actually working in 1.2.0, and all the changes with the new algorithm accidentally fixed that bug. I see no visible difference between bi-level and monochrome; monochrome should, in theory, be thresholding only the parts that "look like a barcode", leaving the other parts dithered like before, whereas bi-level should be thresholding the whole thing.

Until a new version is released (> v1.2.0), you have to build from source. I mostly just followed .github/workflows/build.yml, (with the modification of using PAPPL v1.4.3, because PAPPL 2.0 requires CUPS 3.0, which would require building yet another thing from source):

  1. git clone https://github.com/michaelrsweet/lprint.git && cd lprint
  2. brew install cppcheck libjpeg libpng libusb openssl@3 pkg-config
  3. git clone https://github.com/michaelrsweet/pappl.git && cd pappl && git checkout v1.4.3 && ./configure --enable-debug && make && sudo make install && cd ..
  4. ./configure --enable-debug --enable-maintainer --enable-sanitizer
  5. sudo make install
  6. Start the server with lprint server -o log-level=debug -o listen-hostname=localhost -o server-port=8000. Note that while the server is running, printers are publicly accessible on the local network. I usually just ctrl-R and search for this in my zsh history when I need to run it (easy thanks to fzf).
  7. Go to http://localhost:8000.

Now LPrint is installed from source. To set up the LP-2844:

  1. Plug it in, either via USB directly to the computer, or via Ethernet, either to the computer, or to some network adapter that can expose it on your LAN (like a port on your router, etc.)
  2. On http://localhost:8000, Add Printer
  3. Give it a name (no spaces to make life easier), select the device (USB, or enter the IP address), use the Zebra EPL Page Mode 4-inch/203dpi/Direct-Thermal driver
  4. In another terminal, lprint modify -o print-darkness=100 -o printer-darkness=100 -d <printer name>
  5. Open System Preferences > Printers and Scanners
  6. Click +
  7. Select <printer name> from the list (it'll be Bonjour), click Add
  8. Print something and select this printer! Be sure to select paper size as 4x6, not the 8.5x11 default. To avoid having to do this every time, choose "Last Used Settings" from presets; this will stay selected next time you print.
  9. Ctrl-C the server when done. It takes a while to shut down.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment