5x12 pentomino tiling

Creating PDFs on the Fly


So, with the help of various people who read these posts, all our walks on the WalkLakes site now includes the option to download the walk in Adobe/PDF format.

The PDF version includes all the photos and maps. This should mean it paginates a lot better (printing a long web page never ends well) and also that if your mobile phone or tablet can open PDFs, and most can now, then you can download the walk into your device and save it for later reference1.

Creating each PDF is fairly straightforward. It's all done on the fly2 using some software called htmldoc. This is Open Source software which converts HTML documents into indexed HTML, Adobe/PostScript, or Adobe/PDF format files. So in our case we take the walk, render it to HTML using a template, and then throw that at htmldoc for it to convert to a PDF.

htmldoc is pretty good at this but it has its limits. The most important is that it doesn't know about CSS.

At all.

So you suddenly find yourself in a time warp where you are doing things like using <small>...</small> tags to make text smaller and <font color="#CC0000">...</font> tags to set the colour of text. For boxes tables are vital and you get to rediscover the cellpadding, cellspacing and border attributes.

But it's not all bad news. You can add page breaks thus <!-- PAGE BREAK --> and get it to add headers and footers in a variety of formats and even have a custom title page (another HTML file with the same limitations).

Anyway, enough geekery. You can now download the Adobe/PDF version of any walk by selecting it using our walk finder (click on the "WALKS" tab) and then look for the "Walk in Adobe/PDF format" link.


  1. Although we would be failing in our duty if we didn't warn you not to just rely on a set of walk instructions stored in your device, always take a printed map: they don't break and the batteries can't go flat! Each PDF includes a warning notice to that effect
  2. This isn't entirely true: htmldoc is quite processor intensive so we cache the resulting PDF for a while so if anyone asks for it again we can serve the copy from the cache.

Tags: WalkLakes Written 17/04/13

Comment on this article

« »
I am currently reading:

A History of Women in 101 Objects by Annabelle Hirsch Game On by Janet Evanovich

Word of the Day: