<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>deviled eegg</title>
	<atom:link href="http://eegg.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://eegg.wordpress.com</link>
	<description>Knowing what / thou knowest not / is in a sense / omniscience  --  Piet Hein</description>
	<lastBuildDate>Thu, 04 Aug 2011 11:22:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='eegg.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>deviled eegg</title>
		<link>http://eegg.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://eegg.wordpress.com/osd.xml" title="deviled eegg" />
	<atom:link rel='hub' href='http://eegg.wordpress.com/?pushpress=hub'/>
		<item>
		<title>The Thatcher effect in typography</title>
		<link>http://eegg.wordpress.com/2010/02/10/the-thatcher-effect-in-typography/</link>
		<comments>http://eegg.wordpress.com/2010/02/10/the-thatcher-effect-in-typography/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 21:52:22 +0000</pubDate>
		<dc:creator>eegg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://eegg.wordpress.com/?p=92</guid>
		<description><![CDATA[Near my home, on my dog-walking route, there&#8217;s a small business called &#8216;FDM.&#8217;  Their initials are emblazoned in 2000pt capitals on the side of the property.  I don&#8217;t know what it stands for, or what they do.  The reason I bring them up is a one screamingly disrespectful disregard for typography, in what is an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=92&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Near my home, on my dog-walking route, there&#8217;s a small business called &#8216;FDM.&#8217;  Their initials are emblazoned in 2000pt capitals on the side of the property.  I don&#8217;t know what it stands for, or what they do.  The reason I bring them up is a one screamingly disrespectful disregard for typography, in what is an otherwise entirely sober Roman-esque sign.</p>
<p>I&#8217;m going to first show it to you upside down, in a fictional billboard advertisement sponsored by the lovely Jayma Mays:</p>
<p><a href="http://eegg.files.wordpress.com/2010/02/flipped.png"><img class="aligncenter size-full wp-image-93" title="flipped" src="http://eegg.files.wordpress.com/2010/02/flipped.png?w=480&#038;h=256" alt="" width="480" height="256" /></a></p>
<p>Lovely &#8212; both of them sexy and sophisticated; both with subtle, clean curves that demand attention precisely due to their understatedness; both enticing you, by just giving a little away, to look further.</p>
<p>Right?</p>
<p>Yes, until the potential customer stops sitting in the driver&#8217;s seat upside-down, or reverts from their hand-walking on the pavement:</p>
<div style="height:500px;">&#8230;</div>
<p><a href="http://eegg.files.wordpress.com/2010/02/right-side-up.png"><img class="aligncenter size-full wp-image-94" title="right-side-up" src="http://eegg.files.wordpress.com/2010/02/right-side-up.png?w=480&#038;h=256" alt="" width="480" height="256" /></a></p>
<p>WTF?!  Or should I say, MTF?  The &#8216;M&#8217; has suddenly broken in two and fallen in on itself.  Why was it considered a good idea to use an upside-down &#8216;W&#8217; in place of the &#8216;M&#8217; into which the artist had poured countless hours of labour in order to be completely unobtrusive?</p>
<p>Is it intended as &#8216;attention-grabbing&#8217;?  It works; but not all publicity is good publicity &#8212; I&#8217;m going to have to find myself a new dog-walking route.</p>
<p><em>p.s.; I&#8217;m sorry, Jayma.  Every stroke of the GIMP brush was like a dagger in your baby-soft skin.  But it was in the name of Typography!</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eegg.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eegg.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eegg.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=92&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://eegg.wordpress.com/2010/02/10/the-thatcher-effect-in-typography/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c037e51c81ff40b910e63b6f9dab5230?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">eegg</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/02/flipped.png" medium="image">
			<media:title type="html">flipped</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/02/right-side-up.png" medium="image">
			<media:title type="html">right-side-up</media:title>
		</media:content>
	</item>
		<item>
		<title>Page margins in principle and practice</title>
		<link>http://eegg.wordpress.com/2010/01/25/page-margins-in-principle-and-practice/</link>
		<comments>http://eegg.wordpress.com/2010/01/25/page-margins-in-principle-and-practice/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 23:28:57 +0000</pubDate>
		<dc:creator>eegg</dc:creator>
				<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://eegg.wordpress.com/?p=20</guid>
		<description><![CDATA[Imagine a book with no page margins. The text runs right to the edge of the paper. You&#8217;ll have to crack the spine to gain access to characters in the gutter. To access the text at the bottom, you have to move your thumbs our of the way. If the book is a little old, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=20&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Imagine a book with no page margins. The text runs right to the edge of the paper. You&#8217;ll have to crack the spine to gain access to characters in the gutter. To access the text at the bottom, you have to move your thumbs our of the way. If the book is a little old, the characters on the outside may be worn off entirely. No header or footer is present, so navigation is a task. To make a note on something you find, you&#8217;ll have to write it between the lines. We haven&#8217;t even mentioned the fact that the book looks horrible, or has forced the publisher through hoops to produce the book in full bleed.</p>
<p>The margin, then, is an essential element of all paged media. It solves all the horrors above: spinal injuries are greatly reduced; the closed book when dropped has its content protected by a chunk of wood; you can hold it comfortably; page numbers and section titles guide you around; you have space for marginalian comments; the composition is pleasing; and &#8216;printing on the edge&#8217; is no longer an issue (you can&#8217;t do it with your home printer).</p>
<h2>Competing rationales</h2>
<p>So margins are a Good Thing. In implementing them, though, we&#8217;ll have to be more specific: how big should the four margins (top, bottom, inside, outside) be, given the size of the book?</p>
<p>This simple question doesn&#8217;t have a simple answer. The big reason for this is <em>competing rationales</em>; for each design consideration there is a different optimum:</p>
<table>
<thead>
<tr>
<th>Goal</th>
<th>Ideal margin appearance</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Save the book&#8217;s spine</strong></td>
<td>Give precedence to the inside margin, especially in fat books.</td>
</tr>
<tr>
<td><strong>Blank space for holding the book</strong></td>
<td>Precedence to the bottom and outside margins.</td>
</tr>
<tr>
<td><strong>Wear does not affect book content</strong></td>
<td>Precedence equally to all but the inside margin, which doesn&#8217;t wear.</td>
</tr>
<tr>
<td><strong>Navigation is easy</strong></td>
<td>Precedence to the top and bottom margins.</td>
</tr>
<tr>
<td><strong>Ample space for reader&#8217;s notes</strong></td>
<td>Precedence to outside margin.</td>
</tr>
<tr>
<td><strong>Pleasing composition</strong></td>
<td>Printed area vertices lie on page &#8220;ley lines&#8221;; geometrical ratios.</td>
</tr>
<tr>
<td><strong>Don&#8217;t require print bleed</strong></td>
<td>At least 5mm on all margins.</td>
</tr>
</tbody>
</table>
<p>So different goals are pushing in different, sometimes opposite, directions. Some goals are independent of the page <em>area</em>; some are not. Some are independent of page <em>ratio</em>, others not. Some are dependent on book length, others not, and so on.</p>
<h2>Canons of page construction</h2>
<p>Let&#8217;s begin with the most complex of the design goals: <strong>pleasing composition</strong>. Wikipedia calls these considerations the <a class="reference external" href="http://en.wikipedia.org/wiki/Canons_of_page_construction">canons of page construction</a>. The geometrical means of constructing an ideal page seem surprisingly long-standing and agreed upon. Surprisingly, though, I couldn&#8217;t find implemented algorithms online, so over at github I&#8217;m hosting <a class="reference external" href="http://github.com/eegg/vandegraaf">a small library</a> I&#8217;ve written for this article.</p>
<p>The <strong>first principle</strong> is that some ratios are <em>better than others</em>. These ratios should be applied both to the page and to the printable area. The less ratios in the composition, the letter. They are:</p>
<ul>
<li>2 : 3</li>
<li>1 : φ (the golden ratio)</li>
<li>1 : √2 (the ratio governing A3, A4, A5 paper, <em>etc.</em>)</li>
</ul>
<p>The <strong>second principle</strong> is that the rectangle defining the printable area should have vertices that lie on what I would call &#8220;ley lines&#8221;. If you have a two-page spread in front of you, these lines are those you can draw between five vertices: the four corners of the book plus the top of the gutter.</p>
<p>A <strong>third principle</strong>, not always applied, is that the <em>print width</em> should be the same as the <em>page height</em>.</p>
<p>A few different methods exist over at Wikipedia, aiming for the above goals. Most actually boil down to the same result: the <strong>Van de Graaf canon</strong>.  This is the most general algorithm, and the two other main methods obtain the same result when the page ratio is 2 : 3.  I&#8217;ll let you judge for yourself whether the results are pleasing. In order of decreasing page height, these are outputs from my above script:</p>
<div id="attachment_26" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-phi.png"><img class="size-full wp-image-26" title="van-de-graaf-1-phi" src="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-phi.png?w=480&#038;h=387" alt="" width="480" height="387" /></a><p class="wp-caption-text">The Van de Graaf Canon at 1:φ page ratio</p></div>
<div id="attachment_22" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/van-de-graaf-2-31.png"><img class="size-full wp-image-22" title="van-de-graaf-2-3" src="http://eegg.files.wordpress.com/2010/01/van-de-graaf-2-31.png?w=480&#038;h=359" alt="" width="480" height="359" /></a><p class="wp-caption-text">The Van de Graaf Canon at 2:3 page ratio</p></div>
<div id="attachment_25" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-sqrt2.png"><img class="size-full wp-image-25" title="van-de-graaf-1-sqrt2" src="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-sqrt2.png?w=480&#038;h=338" alt="" width="480" height="338" /></a><p class="wp-caption-text">The Van de Graaf Canon at 1: √2 page ratio</p></div>
<div id="attachment_27" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-1.png"><img class="size-full wp-image-27" title="van-de-graaf-1-1" src="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-1.png?w=480&#038;h=240" alt="" width="480" height="240" /></a><p class="wp-caption-text">The Van de Graaf Canon at 1:1 page ratio</p></div>
<div id="attachment_28" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/van-de-graaf-3-2.png"><img class="size-full wp-image-28" title="van-de-graaf-3-2" src="http://eegg.files.wordpress.com/2010/01/van-de-graaf-3-2.png?w=480&#038;h=160" alt="" width="480" height="160" /></a><p class="wp-caption-text">The Van de Graaf Canon at 2:3 page ratio</p></div>
<p>Let&#8217;s say you agree with me that the above are beautiful.  Note that, looking at the right-hand page:</p>
<ul>
<li>the printed area is the same shape as the page area</li>
<li>the top left and bottom right vertices of the printed area lie on the diagonal of the right-hand page</li>
<li>the top right vertex of the print area lies on the diagonal of the two-page spread</li>
<li>the gutter margins together are the same width as an outer margin</li>
</ul>
<h2>Meditation on the Van de Graaf</h2>
<p>I would guess that your first thought after looking at these (other than that they&#8217;re attractive), is that they are so liberal in their use of space.  I would secondly guess that your thinking that derives from experience: have you ever seen a bottom margin as big as that on the 1:φ ratio?  Why not?  The answer lies firstly in the <em>competing rationales</em> above, and secondly in more rationales, aiming to reduce margins to nothing, that I now list here:</p>
<ul>
<li><strong>Spend less on paper.</strong> Paper margins and profit margins aren&#8217;t friends.</li>
<li><strong>Save trees.</strong> Publishers and consumers alike are conscious of the environment.</li>
<li><strong>Save space and weight.</strong> Less margin means paying for less shelf space at the bookshop.  Volume and weight could be halved, which reduces transportation costs for the publisher and consumer (you&#8217;re travelling with your <em>Comprehensive Travel Guide to Asia</em>; decide between buying the Van de Graaf edition, or buying a zero-margin copy letting you squeeze another pastel-coloured holiday novel in your suitcase).</li>
</ul>
<h2>Data-gathering</h2>
<p>I&#8217;ve got about as far as I can with theory.  I decided at this point to take some measurements of some books on my shelf.  (The data from my twenty samples is in an OO spreadsheet in the about git repo.)  Here&#8217;s some summary findings:</p>
<ul>
<li>Books, and the printable area, are taller and thinner than Jan Tischichold&#8217;s use of the 2:3 ratio.  The average is 2:3.1 for page size, and 2:3.3 for printable area &#8212; hovering around 1:φ but not hitting it.</li>
<li>The printable area was invariably taller and thinner than the page area, compared to the constant ration of the Van de Graaf.</li>
<li>Publishers can&#8217;t decide between bigger outside margins (space for comments, <em>&amp;c.</em>) and bigger inside margins (saving cracked spines).  On average, the ratio of inside to outside was 1:1, but few or not hit that deliberately.</li>
</ul>
<h2>The Typography of Discworld</h2>
<p>I found many page constructions that were unappealing, niggardly, and un-functional.  However, I did come across a few that were not.  One neat one is in the Corgi editions of Terry Pratchett&#8217;s Discworld books.  The construction is as follows.</p>
<p>Draw the diagonals of the full-page spread.  Next draw the &#8216;V&#8217;-shape as in the Van de Graaf, but upside-down.  Mark the verticals at the intersections (thus dividing the spread into three equal slices, as in the Van de Graaf).  Draw diagonals from the intersections to the bottom of the vertical on the opposite page.  The new intersections are the inside bottom of the printable areas.  Draw two more diagonals, from the top of the verticals to the outside bottom corners of the same page.  From the two known printable area vertices, draw horizontally; the intersection at the new diagonal is the outside bottom of the printable area.  Finally, draw vertically until you hit the &#8216;V&#8217;; this marks the top of the printable area.  Look at it:</p>
<div id="attachment_37" class="wp-caption aligncenter" style="width: 489px"><a href="http://eegg.files.wordpress.com/2010/01/discworld_canon1.png"><img class="size-full wp-image-37" title="discworld_canon" src="http://eegg.files.wordpress.com/2010/01/discworld_canon1.png?w=480" alt=""   /></a><p class="wp-caption-text">Geometrically constructing the page of a Corgi Discworld book (my image)</p></div>
<div id="attachment_41" class="wp-caption aligncenter" style="width: 489px"><a href="http://eegg.files.wordpress.com/2010/01/van_de_graaf_canon.png"><img class="size-full wp-image-41" title="van_de_graaf_canon" src="http://eegg.files.wordpress.com/2010/01/van_de_graaf_canon.png?w=480" alt=""   /></a><p class="wp-caption-text">Constructing the Van de Graaf canon on the same page spread</p></div>
<p>The Discworld canon certainly looks similar in geometric spirit, but they are dissimilar in other ways.  The Discworld gives you more page area (66% compared to 44%).  It throws most of the outside margin away, disregarding the aesthetic principle that the gutter width should be the same as one outside margin.  Take a look at it on the same page ratios I used earlier:</p>
<div id="attachment_42" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/discworld-1-phi.png"><img class="size-full wp-image-42" title="discworld-1-phi" src="http://eegg.files.wordpress.com/2010/01/discworld-1-phi.png?w=480&#038;h=404" alt="" width="480" height="404" /></a><p class="wp-caption-text">The Discworld canon at 1:φ ratio</p></div>
<div id="attachment_43" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/discworld-2-3.png"><img class="size-full wp-image-43" title="discworld-2-3" src="http://eegg.files.wordpress.com/2010/01/discworld-2-3.png?w=480&#038;h=359" alt="" width="480" height="359" /></a><p class="wp-caption-text">The Discworld canon at 2:3</p></div>
<div id="attachment_44" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/discworld-1-sqrt2.png"><img class="size-full wp-image-44" title="discworld-1-sqrt2" src="http://eegg.files.wordpress.com/2010/01/discworld-1-sqrt2.png?w=480&#038;h=338" alt="" width="480" height="338" /></a><p class="wp-caption-text">Discworld canon at 1:√2</p></div>
<div id="attachment_45" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/discworld-1-1.png"><img class="size-full wp-image-45" title="discworld-1-1" src="http://eegg.files.wordpress.com/2010/01/discworld-1-1.png?w=480&#038;h=240" alt="" width="480" height="240" /></a><p class="wp-caption-text">Discworld canon at 1:1</p></div>
<div id="attachment_46" class="wp-caption aligncenter" style="width: 490px"><a href="http://eegg.files.wordpress.com/2010/01/discworld-3-2.png"><img class="size-full wp-image-46" title="discworld-3-2" src="http://eegg.files.wordpress.com/2010/01/discworld-3-2.png?w=480&#038;h=160" alt="" width="480" height="160" /></a><p class="wp-caption-text">Discworld canon at 3:2</p></div>
<h2>Word processors, and designing a single-page canon</h2>
<p>How do today&#8217;s word processors implement page margins? The first thing to note is that, by default, all pages are symmetrical: there&#8217;s no such thing as left and right pages. Considering that its output will most likely be unbound A4 from a home printer, this makes sense.</p>
<p>Specifically, the following margins are set by default (My figures for Word are based on Google; I don&#8217;t have access to an installation myself):</p>
<table>
<thead>
<tr>
<th>Word processor</th>
<th>Top margin</th>
<th>Bottom margin</th>
<th>Inside margin</th>
<th>Outside margin</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Microsoft Word</strong></td>
<td>1&#8243;</td>
<td>1&#8243;</td>
<td>1.25&#8243;</td>
<td>1.25&#8243;</td>
</tr>
<tr>
<td><strong>OpenOffice Writer</strong></td>
<td>20mm</td>
<td>20mm</td>
<td>20mm</td>
<td>20mm</td>
</tr>
</tbody>
</table>
<p>How were these figures decided upon?  My guess is that foremost they&#8217;re fetishes for an individual measurement system: Word the imperial, Writer the metric.  Neither seems to be a good basis for a sensible default.  For example, when working with an A4 page, in which the long side is an irrational figure (210mm × √2), we would expect irrational figures for the margins, too.  Word&#8217;s decision to go for <em>larger</em> side margins than end margins is especially odd; my survey above put side margins at 60% of end margins.</p>
<h3>First attempt at a single-page canon</h3>
<p>The reason that word processors don&#8217;t have agreed sensible margins is that, seemingly, no canon has been designed for pages that are not part of a two-page spread.  So, why not use our principles from above to create one?  Let&#8217;s proceed:</p>
<ol>
<li>We this time only work with four starting vertices: the four corners of a rectangle.</li>
<li>There are only two &#8216;ley lines&#8217;: the diagonals from one corner to its opposing corner.</li>
<li>We can (and so will) place the printable area&#8217;s vertices on these leylines.</li>
<li>The less ratios, the better: let&#8217;s use the page ratio for the printable area ratio.  (So far is equivalent to a scaling-down of the page rectangle on its centre.  We just need one principle to fix the scale&#8230;)</li>
<li>The printable height is equal to the page width.</li>
</ol>
<p>We end up with the following:</p>
<div id="attachment_49" class="wp-caption alignleft" style="width: 210px"><a href="http://eegg.files.wordpress.com/2010/01/single_page_canon.png"><img class="size-medium wp-image-49" title="single_page_canon" src="http://eegg.files.wordpress.com/2010/01/single_page_canon.png?w=200&#038;h=300" alt="" width="200" height="300" /></a><p class="wp-caption-text">The naïve single-page canon</p></div>
<div id="attachment_50" class="wp-caption alignright" style="width: 210px"><a href="http://eegg.files.wordpress.com/2010/01/single-2-3.png"><img class="size-medium wp-image-50" title="single-2-3" src="http://eegg.files.wordpress.com/2010/01/single-2-3.png?w=200&#038;h=300" alt="" width="200" height="300" /></a><p class="wp-caption-text">The naïve single-page canon at 2:3</p></div>
<p style="clear:both;">
<p>Lovely!  We&#8217;ve just bettered the two biggest word processing packages!  Or have we &#8230;</p>
<div id="attachment_51" class="wp-caption aligncenter" style="width: 160px"><a href="http://eegg.files.wordpress.com/2010/01/single-1-2.png"><img class="size-medium wp-image-51" title="single-1-2" src="http://eegg.files.wordpress.com/2010/01/single-1-2.png?w=150&#038;h=300" alt="" width="150" height="300" /></a><p class="wp-caption-text">Naïve single-page canon at 1:2.  Only 25% of the page used.</p></div>
<div id="attachment_52" class="wp-caption aligncenter" style="width: 310px"><a href="http://eegg.files.wordpress.com/2010/01/single-1-1.png"><img class="size-medium wp-image-52" title="single-1-1" src="http://eegg.files.wordpress.com/2010/01/single-1-1.png?w=300&#038;h=300" alt="" width="300" height="300" /></a><p class="wp-caption-text">Naïve single-page canon at 1:1.  100% of the page used!</p></div>
<div id="attachment_53" class="wp-caption aligncenter" style="width: 310px"><a href="http://eegg.files.wordpress.com/2010/01/single-3-2.png"><img class="size-medium wp-image-53" title="single-3-2" src="http://eegg.files.wordpress.com/2010/01/single-3-2.png?w=300&#038;h=235" alt="" width="300" height="235" /></a><p class="wp-caption-text">Naïve single-page canon at 3:2.  A full 225% of the page used!</p></div>
<h3>A successful single-page canon: the Double-Circle</h3>
<p>Working on a 2:3-ratio sheet, I disregarded the other possibilities.  The naïve canon above varies the printable area wildly with the page ratio, and it won&#8217;t do.  We need one that produces sensible results for all page shapes: tall, square, and fat.  I&#8217;ve developed one that does so, and I call it the <em>Double-Circle Canon</em>.  Here it is:</p>
<div id="attachment_56" class="wp-caption aligncenter" style="width: 210px"><a href="http://eegg.files.wordpress.com/2010/01/double_circle_canon.png"><img class="size-medium wp-image-56" title="double_circle_canon" src="http://eegg.files.wordpress.com/2010/01/double_circle_canon.png?w=200&#038;h=300" alt="" width="200" height="300" /></a><p class="wp-caption-text">Double-Circle canon at 2:3</p></div>
<p>And, as before, let&#8217;s see it in action:</p>
<div id="attachment_58" class="wp-caption aligncenter" style="width: 390px"><a href="http://eegg.files.wordpress.com/2010/01/double-circle-1-phi.png"><img class="size-full wp-image-58" title="double-circle-1-phi" src="http://eegg.files.wordpress.com/2010/01/double-circle-1-phi.png?w=480" alt=""   /></a><p class="wp-caption-text">The Double-Circle canon at 1:φ</p></div>
<div id="attachment_59" class="wp-caption aligncenter" style="width: 390px"><a href="http://eegg.files.wordpress.com/2010/01/double-circle-2-3.png"><img class="size-full wp-image-59" title="double-circle-2-3" src="http://eegg.files.wordpress.com/2010/01/double-circle-2-3.png?w=480" alt=""   /></a><p class="wp-caption-text">The Double-Circle canon at 2:3</p></div>
<div id="attachment_60" class="wp-caption aligncenter" style="width: 390px"><a href="http://eegg.files.wordpress.com/2010/01/double-circle-1-sqrt2.png"><img class="size-full wp-image-60" title="double-circle-1-sqrt2" src="http://eegg.files.wordpress.com/2010/01/double-circle-1-sqrt2.png?w=480" alt=""   /></a><p class="wp-caption-text">The Double-Circle canon at 1:√2</p></div>
<div id="attachment_61" class="wp-caption aligncenter" style="width: 390px"><a href="http://eegg.files.wordpress.com/2010/01/double-circle-1-1.png"><img class="size-full wp-image-61" title="double-circle-1-1" src="http://eegg.files.wordpress.com/2010/01/double-circle-1-1.png?w=480" alt=""   /></a><p class="wp-caption-text">The Double-Circle canon at 1:1</p></div>
<div id="attachment_62" class="wp-caption aligncenter" style="width: 390px"><a href="http://eegg.files.wordpress.com/2010/01/double-circle-3-2.png"><img class="size-full wp-image-62" title="double-circle-3-2" src="http://eegg.files.wordpress.com/2010/01/double-circle-3-2.png?w=480" alt=""  /></a><p class="wp-caption-text">The Double-Circle canon at 3:2</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eegg.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eegg.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eegg.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=20&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://eegg.wordpress.com/2010/01/25/page-margins-in-principle-and-practice/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c037e51c81ff40b910e63b6f9dab5230?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">eegg</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-phi.png" medium="image">
			<media:title type="html">van-de-graaf-1-phi</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van-de-graaf-2-31.png" medium="image">
			<media:title type="html">van-de-graaf-2-3</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-sqrt2.png" medium="image">
			<media:title type="html">van-de-graaf-1-sqrt2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van-de-graaf-1-1.png" medium="image">
			<media:title type="html">van-de-graaf-1-1</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van-de-graaf-3-2.png" medium="image">
			<media:title type="html">van-de-graaf-3-2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld_canon1.png" medium="image">
			<media:title type="html">discworld_canon</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/van_de_graaf_canon.png" medium="image">
			<media:title type="html">van_de_graaf_canon</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld-1-phi.png" medium="image">
			<media:title type="html">discworld-1-phi</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld-2-3.png" medium="image">
			<media:title type="html">discworld-2-3</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld-1-sqrt2.png" medium="image">
			<media:title type="html">discworld-1-sqrt2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld-1-1.png" medium="image">
			<media:title type="html">discworld-1-1</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/discworld-3-2.png" medium="image">
			<media:title type="html">discworld-3-2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/single_page_canon.png?w=200" medium="image">
			<media:title type="html">single_page_canon</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/single-2-3.png?w=200" medium="image">
			<media:title type="html">single-2-3</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/single-1-2.png?w=150" medium="image">
			<media:title type="html">single-1-2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/single-1-1.png?w=300" medium="image">
			<media:title type="html">single-1-1</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/single-3-2.png?w=300" medium="image">
			<media:title type="html">single-3-2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double_circle_canon.png?w=200" medium="image">
			<media:title type="html">double_circle_canon</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double-circle-1-phi.png" medium="image">
			<media:title type="html">double-circle-1-phi</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double-circle-2-3.png" medium="image">
			<media:title type="html">double-circle-2-3</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double-circle-1-sqrt2.png" medium="image">
			<media:title type="html">double-circle-1-sqrt2</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double-circle-1-1.png" medium="image">
			<media:title type="html">double-circle-1-1</media:title>
		</media:content>

		<media:content url="http://eegg.files.wordpress.com/2010/01/double-circle-3-2.png" medium="image">
			<media:title type="html">double-circle-3-2</media:title>
		</media:content>
	</item>
		<item>
		<title>Redundant information in unordered lists: fundamental?</title>
		<link>http://eegg.wordpress.com/2010/01/19/redundant-information-in-unordered-lists-fundamental/</link>
		<comments>http://eegg.wordpress.com/2010/01/19/redundant-information-in-unordered-lists-fundamental/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 12:43:24 +0000</pubDate>
		<dc:creator>eegg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://eegg.wordpress.com/?p=15</guid>
		<description><![CDATA[Let&#8217;s say you have an list of items, in some specific ordering: the list of your friends [james, tom, harry], say, in order of age.  The way I see it, there are two &#8220;types&#8221; of information here: the list items, and the list order. Now, let&#8217;s say you want to make a list of specific [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=15&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you have an list of items, in some specific ordering: the list of your friends <code>[james, tom, harry]</code>, say, in order of age.  The way I see it, there are two &#8220;types&#8221; of information here: the list items, and the list order.</p>
<p>Now, let&#8217;s say you want to make a list of specific &#8220;friendships&#8221;: <code>[(eegg, james), (eegg, tom), (eegg, harry), (james, tom), (tom, harry)]</code>.  Now, there are several &#8216;orderings&#8217; in this list that could be used to convey information: the order in which you list the friendships, and the order in which you list the two friends in each 2-tuple.</p>
<p>But what information can you convey using these orderings?  When specifying a friendship between two people, can you identify two &#8220;roles&#8221; played there?  Answer: no.</p>
<p>So you decide that you want to specify those friendships without putting any information in those orderings.  As you have many friends and space is at a premium, you also decide that you want to compress that data to &#8220;squeeze out&#8221; the wasted data that is taken up by the arbitrary order in which everything is specified.  <strong>Open question: how do you go about this?</strong></p>
<p>Or to put the question a little more mathematically/computer-sciencey: <strong>what is the most spacially efficient way of serializing an arbitrary unordered set of items?</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eegg.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eegg.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eegg.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=15&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://eegg.wordpress.com/2010/01/19/redundant-information-in-unordered-lists-fundamental/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c037e51c81ff40b910e63b6f9dab5230?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">eegg</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Normally, I hand craft my images using vim.&#8221;</title>
		<link>http://eegg.wordpress.com/2010/01/19/normally-i-hand-craft-my-images-using-vim/</link>
		<comments>http://eegg.wordpress.com/2010/01/19/normally-i-hand-craft-my-images-using-vim/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 12:28:53 +0000</pubDate>
		<dc:creator>eegg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://eegg.wordpress.com/?p=13</guid>
		<description><![CDATA[The above is a quote from Sam Ruby&#8217;s blog.  This deliciously innocent pedantry made me choke on my coffee in laughter.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=13&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The above is a quote from <a href="http://intertwingly.net/blog/2008/02/01/SVG-Tidy">Sam Ruby&#8217;s blog</a>.  This deliciously innocent pedantry made me choke on my coffee in laughter.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eegg.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eegg.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eegg.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=13&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://eegg.wordpress.com/2010/01/19/normally-i-hand-craft-my-images-using-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c037e51c81ff40b910e63b6f9dab5230?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">eegg</media:title>
		</media:content>
	</item>
		<item>
		<title>The long road from HTML to PDF</title>
		<link>http://eegg.wordpress.com/2010/01/17/html-to-pdf/</link>
		<comments>http://eegg.wordpress.com/2010/01/17/html-to-pdf/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 16:44:48 +0000</pubDate>
		<dc:creator>eegg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://eegg.wordpress.com/?p=3</guid>
		<description><![CDATA[HTML and PDF are the two most common formats on the web.  With good reason: HTML and friends give you a portability on the screen, while PDF gives you portability on paper.  With a few exceptions, they&#8217;re two ways of displaying the same content, optimized to different media.  So many developers will want to present [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=3&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>HTML and PDF are the two most common formats on the web.  With good reason: HTML and friends give you a portability on the screen, while PDF gives you portability on paper.  With a few exceptions, they&#8217;re two ways of displaying the same content, optimized to different media.  So many developers will want to present their end-users with both ways of viewing their content: are you going to read this on screen, or on paper?  What&#8217;s more, developers will want the brand-image of their site also carried to the end media.</p>
<p>How do we achieve this?  The solution will inevitably involve conversion from a reference format, and I can see three possible architectures here:</p>
<ol>
<li>Develop in HTML; convert this to PDF when needed.</li>
<li>Develop in PDF; convert this to HTML when needed.</li>
<li>Develop in format X; convert this by turns to HTML and PDF when needed.</li>
</ol>
<p>Let&#8217;s dismiss architecture no. 2 straight-away; no sane person develops in PDF.  Architecture no. 3 has some successful implementations (I&#8217;m thinking of <a title="reStructuredText" href="http://docutils.sourceforge.net/rst.html" target="_blank">reST</a> here), but it has at least one problem: it makes difficult my second requirement of bringing the brand-image to both formats.  Why?  Because &#8220;brand image&#8221; will be specified somewhere external to the content itself, in a format specific to content format X, and this will then have to be transformed into CSS on the HTML side, and whatever else on the way to PDF (e.g. through LaTeX, of which I am ignorant).  This is presumably possible, but hard.  The only easy (and sensible) way architecture no. 3 can get around this is to go by the [Format X -&gt; HTML -&gt; PDF] route &#8212; but in this case we&#8217;re back to implementing architecture no. 1.</p>
<p>So, my iron logic dictates that <em>the </em>way of distributing content as both HTML and branding-aware PDF is to use an HTML -&gt; PDF converter.</p>
<hr />Now, searching for this will bring you examples of software making valiant attempts to implement all of HTML and CSS, including the CSS2 and 3 additions for paged media.  I know of three converters of this type:</p>
<ul>
<li><a title="pisa" href="http://www.xhtml2pdf.com/">Pisa, or XHTML2PDF</a>.  Written in Python, under GPL or commercial license.</li>
<li><a title="dompdf" href="http://www.digitaljunkies.ca/dompdf/">dompdf</a>, &#8220;a (mostly) CSS 2.1-compliant HTML to PDF converter.&#8221;  Written in PHP, licensed under LGPL.</li>
<li><a title="Prince XML" href="http://www.princexml.com/overview/">Prince XML</a>.  Closed source and bloody expensive, though a free watermarking version is available.</li>
</ul>
<p>I&#8217;m going to dismiss Pisa: my (quickly aborted) experience with it has been awful (every block element was placed in a visible box; loads of lines of CSS were mis-interpreted).  Of the dompdf library, I&#8217;ve actually used it to good effect when writing in PHP.  A couple of problems with it: I&#8217;m not a big fan of PHP (not well-suited to my ideal usage of a converter on the command line), and some things it couldn&#8217;t handle so well: in particular, pagination (with tables), the crucial ability of anything converting to a page-oriented format.</p>
<p>The third, Prince XML, is <a href="http://tomayko.com/writings/princexml">pretty good at what it does</a>.  However, the free version I&#8217;ve tried out places its logo on the first page.  I don&#8217;t want this blemish on my lovely-crafted documents; nor do I want to waste my precious printer ink.  I considered hacking away the watermark: firstly inserting an extra first page via CSS, then slicing off the first page of the PDF, but this fudges things like page numbering; secondly by programmatically removing the watermark, but this came to nil too (I couldn&#8217;t figure out how to do it).  In any case, I don&#8217;t feel comfortable violating the license like that, and it&#8217;s an ugly solution.  Also, did I mention that Prince XML is bloody expensive?</p>
<hr />It took me quite a while to realise what is now an obvious point: all these programs are reinventing the wheel.  They are literally implementing their own browser and its ability to print to PDF.  Most of you can do all that right now: File &gt; Print &gt; Print to File, depending on your browser.  The happy realisation is that the bulk of the work needed for our task is right here, hidden away in our open-source browsers.</p>
<p>But let me re-cap exactly what I want to be able to do:</p>
<p><code><br />
eegg@pc:~ ls<br />
foo.htm<br />
</code><code>eegg@pc:~ </code><code>cat foo.htm | html2pdf &gt; foo.pdf<br />
eegg@pc:~ ls<br />
foo.htm    foo.pdf<br />
</code></p>
<p>This CLI program, html2pdf, is not so difficult to create, considering that it just has to harness the power of a browser engine.  Gecko, the Firefox engine, uses the cairo graphics library, which can produce PDFs.  It seems logical, therefore, that it could easily be harnessed (<a href="http://tomayko.com/writings/pining-for-pdf-in-gecko">here&#8217;s</a> one long request for that).  One attempt has been made at a plugin that allows you to order a PDF copy of the page when launching Firefox: <a href="http://sites.google.com/site/torisugari/commandlineprint2">cmdlnprint</a>.  It works, with some fairly big shortcomings:</p>
<ul>
<li>You have to have an installation of Firefox.</li>
<li>Despite being ordered from the command line, it launches a window before doing its thing.  When I first used this for a batch job, I had hundreds of windows open and my computer ground to a halt.</li>
<li>It&#8217;ll interact with your ordinary Firefox profile &#8212; if you set your paper size to A5 for a print job in your lunch hour, your later batch jobs will use the same setting.  Yes, you can create a separate profile for the conversion job, but my experience of this hasn&#8217;t been good.</li>
<li>Firefox doesn&#8217;t seem to have very good support for CSS when it comes to printing.  It doesn&#8217;t seem to play well with paper sizes, print margins, and other things.</li>
</ul>
<p>So, what engines <em>will</em> work well?  Let&#8217;s have a look at <a href="http://www.deepbluesky.com/blog/-/browser-support-for-css3-and-html5_72/">some cross-browser tests for HTML5 and CSS3</a>.  Flying ahead is Safari, the Mac browser.  Before you lament, &#8220;I&#8217;m not on a Mac!&#8221;, these results are those of <a href="http://webkit.org/">WebKit</a>, the engine behind Safari, and WebKit is open source and free.  So where is WebKit outside of Safari?  WebKit requires a widget toolkit in order to run, and the two toolkits in my world are Qt and GTK.  These both have projects at integrating WebKit; respectively, <a href="http://trac.webkit.org/wiki/QtWebKit">QtWebKit</a> and <a href="http://webkitgtk.org/">WebKitGTK</a>.</p>
<hr />Herein lies the answer.  I stumbled across a project which seemingly has next to no publicity.  Without further ado, it&#8217;s <a href="http://code.google.com/p/wkhtmltopdf/">wkhtmltopdf</a>.  That&#8217;s WebKit HTML to PDF.  What&#8217;s more, if you&#8217;re on a Debian system, it&#8217;s in the repository.</p>
<p>How good is it?  I tested it against the HTML+CSS in <a href="http://www.alistapart.com/articles/boom">an article a A List Apart</a> taking about using of Prince XML.  Compared to the output that Prince XML created from it, it&#8217;s fairly impressive.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eegg.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eegg.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eegg.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eegg.wordpress.com&amp;blog=11488469&amp;post=3&amp;subd=eegg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://eegg.wordpress.com/2010/01/17/html-to-pdf/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c037e51c81ff40b910e63b6f9dab5230?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">eegg</media:title>
		</media:content>
	</item>
	</channel>
</rss>
