Automatically Printing Text Files to a Thermal Printer

Ever since seeing this Microprinter post I’ve been fascinated by the idea of having a thermal receipt printer to play with. But they were always a bit too pricey for a toy, and I wasn’t sure that even if I got one I’d be able to make it work.

Then I discovered the Printer project over at Go Free Range. James Adam had already done most of the work for me. He’s got detailed instructions on how to put this together with a cheap thermal printer from Adafruit, an Arduino with an ethernet shield, and a few LED’s, resistors, and wires.

What I’ve done is written a python script that takes a folder full of text files, converts them to HTML via Markdown, and then sends them to one of these free range printers. Here it is in action:

Here’s the script. It includes the Markdown python library and all the other libraries are standard, so you shouldn’t need to track down any dependencies. You’ll just need to update the variables in the printtxt.py script to point to your folders and your printer URL.

I’ve pointed the script at a folder in my Dropbox, which means that I can save these text files from anywhere and have them print out automatically. I’m also using Hazel on a Mac Mini to automate running the script as soon as a new file arrives in the To Print folder, but you could just as easily run the script via chron or the Windows Schedule Task program.

What will I use this for? I don’t know yet. But I think it’s pretty neat.

Posted on
May 13, 2012 10:10 am
 
 

6 Responses to “Automatically Printing Text Files to a Thermal Printer”

  1.  

    Bravo! Microprinters rule!

  2.  

    Excellent stuff. I’m going to try this on my Raspberry Pi-powered GFR printer very soon.

  3.  

    [...] Then I had an idea. I use IFTTT to email myself a weather forecast every morning. IFTTT stands for If This, Then That (or is it ‘If That, Then This’?). It glues together different web sites and services like Gmail, Flickr and Twitter in ways that can be incredibly useful. I had an idea to use the weather service on IFTTT combined with JD Harper’s really neat idea for using Dropbox text files as a way of printing to a GoFreeRang…. [...]

  4.  

    Superb stuff. I’ve used this as a basis of printing a weather forecast on my little printer every morning: http://www.suppertime.co.uk/blogmywiki/2013/05/printweather/

  5.  

    [...] first time I got this working, I had to have a Mac turned on, as this was running JD Harper’s Python script to poll DropBox for new files to print. Having to keep a Mac running was a bit of a drag, [...]

  6.  

    [...] Then I had an idea. I use IFTTT to email myself a weather forecast every morning. IFTTT stands for If This, Then That (or is it ‘If That, Then This’?). It glues together different web sites and services like Gmail, Flickr and Twitter in ways that can be incredibly useful. I had an idea to use the weather service on IFTTT combined with JD Harper’s really neat idea for using Dropbox text files as a way of printing to a GoFreeRang…. [...]

Leave a Reply

Name and Mail fields are required. Emails will not be published.