Printing to e-ink

posted on February 09, 2007

I bought myself a Sony Reader a few weeks ago. I'd been lusting after an e-ink based e-book reader since I first read an article about the technology in Popular Science almost 10 years ago. And now they exist! And can display PDFs!

I've been hacking on various randomness for the Reader since buying it. I've gotten familiar with the various PDF/PostScript-manipulation/-generation tools1; figured out the PDF viewer's exact usable screen area; wrote a small LaTeX class for Reader content and a usable-for-me Project Gutenberg TXT --> LaTeX converter2 (more on those after polishing); and figured out how to "print" directly to the Reader from Firefox (er, "Iceweasel") on GNU/Linux.

The following instructions form a rough guide to the last of those:

  1. Grab my lpr-reader.rb Ruby script and stick it in your PATH. Modify the script if you want "printjobs" to end up elsewhere than on your SD card. It depends on facets, Ghostscript, pdftk, Xdialog3, and Kovid Goyal's libprs500 command-line tools, so install all of those and their dependencies.
  2. Wasn't that fun? Nod your head "yes."
  3. In Firefox, go to the infamous URI about:config and find/create the key print.printer_list. It's a space-separated list of printer names, so add to it 'reader-portrait reader-landscape'.
  4. Find your Firefox profile directory (~/.mozilla/firefox/<profile>/), find/create user.js there, and copy into it the contents of lpr-reader.js (not just copy lpr-reader.js into the directory).
  5. Restart Firefox.
  6. Plug in your Reader and use the new printers to print a Web page! As the names might suggest, reader-portrait produces portrait-orientation PDFs while reader-landscape produces landscape-orientation PDFs.

Enjoy!, and please submit any patches to code or process via comments or e-mail.

1 Mostly the Ghostscript suite, html2ps, and pdftk.

2 I do know about GutenMark, but it has some pretty significant limitations — I'm getting much better results for LaTeX generation from a 200 line Ruby script.

3 Yes, yes — it should actually use a widget library. Feel free to submit a patch.

Commentary most sage