Printing Web Apps 1.0

This is a quick guide for getting a dead-tree version of the Web Applications 1.0 spec. The advice is biased towards Mac OS X fonts. The use of Prince is assumed. A laser printer with black ink only is assumed.

  1. Get Prince. As of today, the latest alpha is Prince 6.0 (alpha 2007-03-23). This guide should work with Prince 5.1 as well. (Thanks to YesLogic for giving me a Prince license.)

  2. If you are on Mac, make sure you have the broad versions of Microsoft core fonts. The fonts that came with Mac IE or in the .sit core font distribution archives have a limited legacy glyph repertoire. The fonts that come with MS Office are up to date. If you don’t have the MS Office versions, you can get the .ttf versions from SourceForge. (Note that some Carbon apps that use legacy APIs don’t render the .ttf versions as nicely as they render the suitcased versions.)

  3. Get the DejaVu font family. Install the .ttf files in /usr/local/lib/prince/fonts/ (assuming you installed Prince under /usr/local/). I could not get DejaVu to work with Prince from /Library/Fonts on Mac.

  4. To fill in the rest of the glyphs missing after Arial, Helvetica and DejaVu, it is assumed that you have STHeiti that ships with OS X. I don’t know what font is a suitable substitute on Linux or Windows. Please let me know if you have a suggestion.

  5. Patch your /usr/local/lib/prince/style/fonts.css with this patch.

  6. Navigate to the Web Apps spec in Firefox. Choose “Save Page As…” and as format “Web Page, complete”. This will save all the dependencies except the green “Working Draft” background image, which you probably don’t want to use ink for anyway. The name you pick here is referred to as filename.html below.

  7. Download specification-a4.css if you use internationally standardized paper or specification-letter.css if you are ISO-challenged, rename it to specification.css and replace filename_files/specification.css with it.

  8. Open filename.html in a text editor.

  9. Add <meta http-equiv="content-type" content="text/html; charset=utf-8"> as the first child of <head>.

  10. Locate the table of entities by searching for “AElig”. Wrap the table in <div id='hsivonen-entity-table'></div>. (It appears that Prince does not support ::outside on tables.)

  11. Save.

  12. Run Prince with prince --input=html filename.html. It will complain about the missing background image. This is harmless.

  13. Print filename.pdf.

    Initially, I tried to print the PDF by first converting it to PostScript using pdftops (Xpdf-based; not the same as pdf2ps which is GhostScript-based). I’ve had mixed results with pdftops. It generates smaller PostScript files (around 38 MB) than Adobe’s or Apple’s implementation. However, sometimes there are glitches with changed glyphs within a font and sometimes the output doesn’t work with a particular printer. Also, be sure to specify -duplex as pdftops overrides the print queue duplex setting to simplex by default! Adobe’s and Apple’s implementation generate over 100 MB of PostScript but seem to be more reliable. I used eventually Adobe Reader 7 on Solaris to generate the PostScript for printing.

In case you are happy with today’s snapshot and don’t want to typeset the PDF yourself, here is revision 691 from 2007-03-23 as A4 and Letter.