Printing DocBook

Volume 3, Issue 1; 10 Jan 2019

Support for printed, as in, ink on (often virtual) dead trees, output in the DocBook XSLT 2.0 Stylesheets is, uh, weak. Yeah, let’s say “weak”. How should I address that?

Thoughts are ephemeral, they evaporate in the moment they occur, unless they are given action and material form. Wishes and intentions, the same. Meaningless, unless they impel you to one choice or another, some deed or course of action, however insignificant. Thoughts that lead to action can be dangerous. Thoughts that do not, mean less than nothing.

Ann Leckie

The DocBook XSLT 2.0 Stylesheets do not get the love and attention that they deserve. This is mostly a question of competing priorities on my part and lack of engaged collaborators for the 2.0 (and dare I dream, 3.0) work. None of my work on open XML technologies is employer supported anymore so it all has to fit in my spare time. And there’s still a lot of it (work, that is, not spare time). Hours in the day And the [expletive deleted] broken keyboard on this MacBook Pro, but that’s a rant for another day. I preemtively blame any extraneous “s”, “o”, “t”, or “e” characters on the keyboard. are my curse.

The HTML stylesheets are pretty good. They produce nice, clean HTML5. It styles well with CSS and is amenable to some JavaScript processing if the need arises. I’ve been using them for years without any real problems. However, I am reminded periodically that the print stylesheets are no where near as complete.

And I’m not sure what to do about that. I have two competing approaches in my head and there’s absolutely not enough of my free time to do both of them.

  1. Go all in on the FO stylesheets, bring them up to scratch to produce printed pages.
  2. Write an extension layer on top of the HTML stylesheets to produce HTML suitable for styling with CSS for paged media and use that to produce printed pages.

In favor of the former, lots of folks apparently still produce paged media with FOP. Also, there haven’t historically been any free processors for producing paged media with CSS. You cannot do it with the browser, don’t even try.

In favor of the latter, that’s where all the future development is going to be. Once you accept that you’re going to have to buy a processor you can find a range of CSS paged media processors. At the high end, a processor like Antenna House delivers, as near as I can tell, essentially equivalent capability in FO and CSS. Also in favor is the fact that it is possibly less work. It means learning a bit more about CSS, but that’s probably a good thing anyway.

Almost all of my spare cycles recently have been devoted to the XProc 3.0 specification and my implementation of it. Thing is, the specification is coming along nicely. You might want to come to XML Prague to hear more about that, I’m just saying.

My current favorite way of doing reviews of specifications is to annotate the PDFs in GoodNotes. That’s motivated me to think that when the final 3.0 specification comes out, I’d really like to have a nice PDF render of it.

And that means devoting some time to the print stylesheets. And that means picking a technology.

But which one?