Joel Franusic (joel) wrote,
Joel Franusic

How to print to a DYMO LaserWriter Twin Turbo from a Mac when you only have 2 hours to figure it out

UPDATE: I've made lots of little updates to this.

I'm at SHDH26 right now. We now have a fancy login system that prints out name tags for you!

Tom Harrison, Ernesto S., and David S. had most of the system working last night, with the exception of the automatic label printer. This morning rndmcnlly and I got the printer working in about 2 hours!

Here is how we did it:

First we had to get the printer working on a Mac, this was pretty easy. We downloaded the drivers and set up the printer though the normal means.

After that we wrote the following two files:


Media: Label 162 288 10 10 152 278

  • Use the command enscript --list-media to make sure that your .enscriptrc is being parsed.
  • Use man enscript for more info
  • The numbers are in Postscript points!


from twisted.web.resource import Resource
from twisted.web import server
from twisted.internet import reactor

from subprocess import *

class Launcher(Resource):
        isLeaf = True
        def render_POST(self, request):
                names = ['first_name', 'last_name']
                items = map((lambda l: request.args[l][0]), names)
                page = "\n".join(items)
                p = Popen(["enscript", "-r", "-B", "-f", "Helvetica35", "-MLabel"],stdin=PIPE)
                return page

reactor.listenTCP(1080, server.Site(Launcher()))

(rndmcnlly  wrote all the python, I just figured out the enscript syntax)

Once the files were written, we ran the printer server using the "python command.

The printer server above listens on port TCP 1080, we had to change the port number because Comcast sucks and blocks that port.

The server listens on port 1080 for a HTTP POST and prints the value "first_name" on the first line and "last_name" on the second line.

Labels are printed by the web application sending a HTTP POST to the port of the computer connected to the printer - we had to set up port forwarding to get this working.

Unfortunately we didn't have time to implement Lee Felsenstein's suggestion to let people "tag" themselves. We'll have that working by the next SHDH - maybe even just let people go freeform on their tags.

Tom's end goal for this is to eventually have a "DevHouse Appliance" that other people could easily set up to do the same thing!
Tags: dymo, enscript, postscript, python, server, shdh

  • MetaCalculate

    I'm sick of Excel. Every time I try and do something a little bit fancy, I have to learn how to do things the special Microsoft way. I want a…

  • Mystery Company #1

    Two months ago I hit the ground running at a new job with a company called NetBooks. They make accounting software for tiny businesses (not tiny…

  • Ozymandias

    I met a traveller from an antique land Who said: Two vast and trunkless legs of stone Stand in the desert. Near them on the sand, Half sunk, a…

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.