Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

print label XML to a Dymo printer on any platform


The Dymo tray application runs on Windows and Mac, but not Linux. I wanted to be able to use the JavaScript SDK to print from a browser on Linux, so I wrote this Ruby program to act like the Dymo app.

This app sets up a small web server on port 41951 and accepts POST requests with XML. The XML is interpretted, albeit not perfectly, and rendered to PDF, which is then sent directly to the Dymo print driver.

You would not normally be writing the XML yourself. Instead, you should build your label in the Dymo software and interface with the API using the Dymo SDK JavaScript Library.

What Works

  • Basic text and auto-shrinking text
  • Text box solid background colors
  • Horizontal lines
  • "Verticalized" text
  • Barcodes

What Doesn't Work, Yet (Pull Requests Welcome!)

  • Rotated text
  • Other shapes
  • Alpha transparency on background colors
  • Multiple font sizes/styles in the same text box (probably not possible)
  • Probably other stuff

What's Quirky

Some text is not placed exactly the same with this app as Dymo would do it. Dymo and Prawn have very subtle differences in how they render text. Some of those differences have been accounted for, but not all.

If your labels rely on precise placement/alignment of different objects, this solution may not work well for you.

Below are some samples:


These instructions should work on Debian and Ubuntu.

  1. Install some prerequisites:

    sudo apt update
    sudo apt install build-essential openssl ruby-dev libssl-dev cups cups-bsd printer-driver-dymo ttf-mscorefonts-installer

    Note: we want cups-bsd to provide lpr -- do not install the lpr package!

  2. Add the Tahoma font, which seems to be Dymo's default:

    cd /tmp
    cabextract -F 'tahoma.ttf' IELPKTH.CAB
    sudo mv tahoma.ttf /usr/share/fonts/truetype/msttcorefonts/Tahoma.ttf
  3. Allow your user account to manage printers with cups:

    sudo gpasswd -a USERNAME lpadmin

    Replace USERNAME above with your user, e.g. pi if running on Raspbian.

  4. Add the printer via the Cups admin page:


  5. Bundle:

    sudo gem install bundler
    git clone
    cd dymo-printer-agent
  6. Generate a self-signed certificate:

    openssl req -nodes -new -x509 -keyout ca.key -out ca.crt -subj /CN=localhost -days 3650
  7. Start the printer agent:

    cd dymo-printer-agent
    ruby agent.rb
  8. There is currently a bug in the Dymo printer driver that causes long delays in between printing each label. In another terminal, start the dymo_speed.rb script to work around this issue:

    cd dymo-printer-agent
    ruby dymo_speed.rb

Running on a Raspberry Pi

My specific use-case for this script was to run it on a Raspberry Pi running Raspbian. I wanted the script to auto-start upon boot of the Raspberry Pi. The following commands will set that up:

echo '@/home/pi/dymo-printer-agent/' >> ~/.config/lxsession/LXDE-pi/autostart
echo '@ruby /home/pi/dymo-printer-agent/dymo_speed.rb' >> ~/.config/lxsession/LXDE-pi/autostart


Copyright Tim Morgan

Licensed under the 2-clause BSD license (see the LICENSE file in this repo)


print label XML to a Dymo printer on Linux (or any platform)







No releases published


No packages published