E-Paper Printer

· 438 words · 3 minute read

Idea: an e-paper printer. You can print to it, same as any printer, but instead of producing paper, it displays the last page printed. That’s pretty much it. I’d hang it on the wall in the kitchen, and I’d print recipes to it. It has no buttons or input, so I wouldn’t get food on it.

I think the virtual-printer interface is important. I don’t want to write an app or curl to it. I just want a better response to the Print action when I’m researching a new recipe for dinner.

Someone has written a tiny IPP server, which looks like a good start. Depending on the hardware on the e-paper side, I might need to change it, as it currently advertises itself as a PDF printer. If the project is based on Raspberry Pi, then it clearly can render PDFs, but if it’s more like an ESP32, then I’d want to modify it to understand PWG raster rather than PDF.

I’d also have to figure out how to do mDNS broadcast, so that the virtual printer would show up on the network. And I hope that printer technology has advanced enough that a phone can discover and add a printer without too much hassle.

Power: ideally this thing would run for a long time off a single 18650 battery. The e-paper would consume zero power most of the time. Unfortunately, for it to show up on the network, it’d have to keep the wifi radio going all the time (or wake up frequently, like every 10 seconds), which would likely kill the battery quickly. So it might need to be wall-powered.

Update

  • To convert a PNG to a BMP that the Waveshare 2.13-inch e-paper HAT’s sample code can handle: convert input.png -resize 122x250\! +dither -colors 2 output.bmp. convert is an ImageMagick tool (apt install imagemagick).
  • You can apt install ippsample a working version of ippsample, and then run ippserver "my-printer" -d ~/printer-tmp/, which will dump a PDF of whatever you print into that directory. Unfortunately, Android phones can see the printer, but they can’t print to it (error).
  • Convert PDF to PNG with pdftoppm input.pdf output -png (apparently the Ubuntu package name is poppler-utils).

This script mostly works (has problems with print jobs of > 9 pages):

#!/bin/bash

TARGET=~/printer-tmp/my-virtual-printer/

inotifywait -m -e create --format "%f" $TARGET \
    | while read FILENAME
        do
            sleep 2
            pdftoppm "${TARGET}${FILENAME}" /tmp/virtual-printer-pdf -png
            convert /tmp/virtual-printer-pdf-1.png -resize 122x250\! +dither -colors 2 ~/Desktop/output.bmp
            echo "converted $FILENAME"
        done

Resources 🔗