Publishing for Little Printer

A quick warning: if you don’t know what Little Printer is, and you’re not interested in PHP/HTML/CSS then this post probably isn’t for you. I’m putting this post up mainly as a HOWTO for those searching for information.

I recently bought a Little Printer from the fine folks at BERG and fell in love straight away. I decided it would be fun to try and produce my own publications for it. I am not a website developer (all the behind-the-scenes stuff for MrReid.org is handled by WordPress) and I’m not much of a programmer either,* but I found the process reasonably easy; BERG’s documentation is very good.

little-printer

A Little Printer publication is basically a small website (like this). The content is regular HTML and it is formatted with CSS as with any other website.

You need four things for a working Little Printer publication:

  • Your content in HTML and CSS format hosted somewhere.
  • meta.json, a JSON file containing metadata about your publication such as its name, how often it’s published, etc.
  • An ETag that tells BERG Cloud when content has been updated.
  • An icon, 55×55 pixels in PNG format, that BERG uses when listing your publication.

meta.json

BERG provides some good documentation for the meta.json file. Embedded below is a copy of the meta.json file I used. I’m not clever enough to work with user-defined options so the external_configuration and config keys are missing.

ETags

This was the part I found most difficult, because I had no idea what an ETag was. It turns out that an ETag is a little bit of code sent in the header of a webpage that identifies the content of the page. If you change the ETag of a page then any crawlers/spiders visiting the page will know that it has been updated.

As I understand it (and it’s entirely possible I’m completely wrong) then what happens is that BERG Cloud’s servers check your publication’s webpage at the user-selected delivery time and only send it to Little Printer if the ETag is different to the last time it was polled for that user.

ETags need to be inserted into your page before any HTML, including before the DOCTYPE declaration. I used the PHP code below to generate and embed ETags into my publications.

Formatting

BERG provide a style guide for Little Printer publications; it’s worth bearing in mind that you can only use the fonts that BERG provide. You cannot use web fonts.

Publications need to be 384 pixels wide. I used the following CSS as a template for my publications:

If you’re going to use images in your publication then you need to assign the class dither to images (e.g. <img class="dither" src="filename.jpg">), otherwise they’ll be thresholded in the rendering process.

dither-threshold-example

Dithered image on the left, thresholded image on the right. The dithered images look much better printed on Little Printer than they do on screen above.

You can find the code for both my publications, Constellatio and World Population, on GitHub: Constellatio and World Population. Please feel free to fork the code.

I wouldn’t have decided to make a Little Printer publication if I hadn’t read revdancatt’s post about how easy it is to create publications; and Alex Forey’s Little Printer PHP Framework gave me the idea to use PHP to generate and embed ETags. Huge thanks to both of them.

* If it’s any indication of how much of a n00b I am, all of the code for my publications was written either in Notepad or in the GitHub in-browser editor. Some of the commit summaries explain the difficulties I had.

Leave a Reply