The Windward Studio

Windward Blog Home

The Eternal Goal of Pixel Perfect Matching

by
Posted on 06/26/2015

Please Share This

 

Our goal from the very first at Windward is to hold up the original template and the generated PDF, one over the other on top of a light, and have pixel perfect matching. Color too. Pixel perfect matching is a goal we’re always working toward. And we’ll never achieve it.

In fact, no one will ever get there because the goal of perfection is unattainable. But we work really hard to get so close to pixel perfect matching that it appears we’ve achieved it.

Why Pixel Perfect Isn’t and Will Never Be

Pixel perfect is pretty in theory but a bit messy in practice.

First off, there are parts of the DOCX spec that are horribly ambiguous. We are, 12 years after Windward was first released, still finding new rules for the spacing at the top of a page. And there’s the lovely case where the content of an element is HTML. Any HTML. With no specification to what the defaults are.

We recently went through line by line for what we do and don’t support. You can take a look at the Output Format Limitations and specifically the Document (Word) limitations in our documentation wiki.

The list of items where Word does not match the DOCX spec is over 4,000 pages and ever growing. We find 2 – 4 additional ones ourselves every year (which we report to Microsoft). We have test PDF files with a 1”x1” square on them and different printers will print a square anything from 0.95”x0.95” to 1.1”x1.1”.

And then there’s the sample templates we have that are displayed differently by Word 2003, 2007, 2010, & 2013. In some cases all four disagree with each other. So which is correct?

The other issue is there are a lot of elements available in a DOCX file. Shapes and SmartArt alone have a gigantic number of elements. The documentation for textbox and image borders runs tens of pages — and that’s just listing all the custom border types. The special Korean bullet types runs several pages long. Because we don’t sell as many copies of Windward as Microsoft does of Office, we have to limit ourselves to a subset of the DOCX elements.

Why Windward Gets Very, Very Close to Pixel Perfect

SVG_logo.svg

We’re working on translating charts, Microsoft Shapes and SmartArt in templates to SVG in HTML output.

Inability to achieve perfection, however, does not mean we give up, because we can keep improving. Every improvement makes the system better. Every element we add an implementation for expands what we handle. We do have a realistic, and mostly achieved goal, that when you’re looking at the two documents side by side, they match.

For example, we’re working on a new approach to how we render charts, Microsoft Shapes and Microsoft SmartArt. Right now they  are rendered to a PNG but this is not ideal as it  results in a bitmap that does not scale and appears degraded as you zoom in and out. Soon we will convert the vector primitives in all three objects into native vectors instead of bitmaps for that output.  We will no longer render images but rather translate them into equivalent drawing commands leading to faster generation of these objects — and the appearance of pixel perfect.

We do have a realistic, and mostly achieved goal, that when you’re looking at the template and the output side by side, they match.

So we keep striving for pixel perfect matching. Because that effort improves our product and in turn our customers’ products.

Read more of Dave’s musings on software, reporting and life in general on Dave’s company blog

Please Share This



Author: David Thielen

Dave, Windward's founder and CEO, is passionate about building superb software teams from scratch and dramatically improving the productivity of existing software teams. He's really proud that he once created a game so compelling (Enemy Nations) that a now-professional World of Warcraft player lost his job for playing it incessantly on company time. You can read more from Dave on his personal blog, and at Huffington Post.

Other posts by