Discuss: Printing a Book with CSS: Boom!
by HÃ¥kon Wium Lie, Bert Bos
- Editorial Comments
22 Docbook
Docbook is a better tool for this job. From their FAQ :
“DocBook provides a system for writing structured documents using SGML or XML. It is particularly well-suited to books and papers about computer hardware and software, though it is by no means limited to them.
In short, DocBook is an easy-to-understand and widely used DTD. Dozens of organizations use DocBook for millions of pages of documentation, in various print and online formats, worldwide.”
By marking a book up in Docbook XML, you can export your book to any suitable format (via an XSLT transformation). There are already tools to convert Docbook documents to html, xhtml, PDF, and more. If writing/marking up a book is your goal, you would be better off using Docbook than reinventing the wheel and writing your own microformat.
posted at 03:54 pm on November 29, 2005 by Jared Hales
23 No auto-hyphenating
Prince costs $350, works from the command line on Mac and Linux, and doesn’t do auto-hyphenating. I own Lie’s book; a whole lot of manual hyphenating must have gone into it. It would to take less time to reformat in free LaTeX than to manually hypenate an entire book.
posted at 04:18 pm on November 29, 2005 by Gary Bloom
24 Re: LaTeX comment
Also, format editors like LaTex are proprietary and will, in the near future be marginalized by free (as in beer) tools that will use common semantics and transforms.
In response to Thom Wiley’s views on LaTeX, it should be noted that LaTeX is free (as in beer) and also as in liberty (it’s under the GNU license). It’s a template extension of an underlying language—TeX—that’s got its own markup defined, multiple viewers, editors, and tools, and it’s been around for more than a decade (TeX began to be formally defined around 1989). You could say that LaTeX is what CSS/(X)HTML is to SGML.
CSS is a great tool, but it’s not really made for the print job. There’s way too many things that need to be considered that CSS simply doesn’t give you control over in real printing/publishing (Fine typesetting and typography, anyone?) It would be a nice way of getting long sets of texts off the web and onto paper, but it’d still look better and be more readable if you threw an HTML page through a text processor (sed or otherwise) and converted it into a LaTeX document, then printed it.
LaTeX isn’t as obscure as one might think. While it’s certainly not a desktop publishing type solution, it’s been around for long enough that it’s a very widely used method of typesetting academic papers and documents.
Maybe, if CSS gained a slew of options that’d allow authors to set and define every aspect that was needed for print, it’d succeed in this field. But for now, it’s a somewhat half baked solution, and its options need a whole lot more implementation (which might never get done) to really fit the bill, even for the smallest self-read page jobs.
That all being said, it’s a very neat concept.
posted at 08:06 pm on November 29, 2005 by Raymond Jimenez
25 Food for Thought
I’m not planning on writing any books with HTML/CSS, but there’s a lot here that can be put into my next print stylesheet.
One thing though, what’s with the first sub-heading: “Print vs. paper”? Aren’t they the same thing? Shouldn’t it be “Print vs. pixel” or “Screen vs. paper”?
posted at 05:22 am on November 30, 2005 by Chris Hunt
26 Printing background colours
Was I the only person suprised to see how poorly Firefox (even the beta) handles the print stylesheet? Even IE handles it better.
What upsets me is that in Opera (even the latest version), ticking the “Print background colour” option appears to include the page background as defined in the screen stylesheet, not the (usually white) one in the print stylesheet. And then the background screen colour clashes with the foreground print colours as these are different from the screen colours – very upsetting!
And it’s very irritating that you can’t allow eg <td> background colours without the page background. I don’t want to print a page of blue, but small blocks of background colour are fine.
posted at 08:35 am on November 30, 2005 by Stephen Down
27 More info ...
Very nice, very very nice, I always wondered if it was possible to print in a decent way using XHTML and CSS ;) and I think it’s great!
In this tutorial I have seen a large use of unknown-to-me syntax, where can I find a full guide to CSS syntax (apart from w3c specifications?).
Thanks
Tommaso Urli
posted at 12:40 pm on November 30, 2005 by Tommaso Urli
28 Untitled
What upsets me is that in Opera (even the latest version), ticking the “Print background colour� option appears to include the page background as defined in the screen stylesheet, not the (usually white) one in the print stylesheet.
Next preview of Opera 9 will probably solve that. See post about that here .
posted at 12:46 pm on November 30, 2005 by Andrey Petrov
29 Untitled
I pretty much agree with the consensus that HTML+CSS are not really tools for printing books. CSS isn’t really designed to turn HTML or XML into print media as much as it’s geared toward styling HTML or XML into something suitable to be printed. HTML doesn’t even have enough semantics to properly markup most college-level papers much less semantics for proper printed media. HTML is lightweight and feature poor.
One side note: I think the use of ‘rel’ and ‘rev’ attributes should have been used with ‘link’ and ‘a’ elements in the HTML.
posted at 02:45 pm on November 30, 2005 by Jonathan Porter
30 What about a disclaimer?
What about mentioning that this is written by a member of the Prince team, touting a product that costs U$349 as the only alternative to produce output from the “microformat” proposed in the article?
Not that the article itself is bad, but a disclaimer would be nice. Or is it there and I read too fast?
posted at 03:12 pm on November 30, 2005 by Manuel Razzari
Discussion Closed
New comments are not being accepted, but you are welcome to explore what people said before we closed the door.
Got something to say?
Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.
Create a new account or sign in below if you’d like to leave a comment.
Subscribe to this article's comments: RSS (what’s this?)



21
For those who were wondering, the OED defines “acronym” as “a word formed from the initial letters of other words,” and “abbreviation” as “a shortened form of a spoken word, or written symbol.” Fowler’s Dictionary of Modern English Usage concurs.
I have run across a suggested distinction in which “acronym” refers only to pronounceable initialisms, but I’m not buying it, myself.
posted at 03:37 pm on November 29, 2005 by Erin Kissane