Suggestions for making pixel-perfect CSS layouts?

2.8k views Asked by At

One business goal requires that I make a form on screen that's pixel-perfect. If a user prints this form, it will exactly match the US Government Printing Office version of the form; the printer will produce a (reasonably) scannable copy of this document. The previous solution is PDF, which will only work to a certain point for us.

I'm leaning towards HTML/CSS, and would like suggestions on tools to assist that.

For tools, PixelPerfect in Firefox seems a good start. The target platform for this is (drum roll) IE6, if it helps. The document looks like this.

If HTML/CSS is a complete no-go, Adobe Flex is my next choice.

5

There are 5 answers

1
stephenhay On BEST ANSWER

Dean, check out Prince. Bert Bos and HÃ¥kon Wium Lie used it for production of their book on CSS. They explain a bit about it in an A List Apart article.

2
mbeckish On

If you're worried about the renderer (IE, Acrobat, etc.) screwing up, you could always render the form on the server, and just serve an image to the user.

3
nickf On

If pixel perfect printing is the goal, and not even PDF will get you there, you can pretty much give up straight away on printing from the browser. There are waaaay too many variables when rendering on the client side: from different browsers (IE6? Good luck!) to different fonts, to user settings, to A4 vs Letter size paper.

Could I ask why PDF doesn't suit?

1
CodeJoust On

I agree that pixel-perfect layouts are very, very hard to achieve with html/css, particularly with forms. However, I think pdfs can recieve input from external web forms, or have textfields that when filled out will print.

Flex outputting to pdf would be a good idea, but I don't think using flex as an rendering engine will help too much with this.

Another option would be to make the pdf and use a server-side langage to customize it with fields from a prior webform, and output the result. (Can easily be done with ruby/django/php, there are some good pdf libraries out there.)

0
MaxVT On

First, abandon pixels. What you're looking for is a print stylesheet, with everything specified using physical units (cm/inches), font size in pt, etc. What is displayed on the screen, in what font size, and whether it is pixel-perfect or not doesn't seem relevant to your requirement of producing a scannable copy.

The question is now, is IE6 support for physical units and print stylesheets complete enough for that? Given my experience with making print stylesheets for clients, where IE would simply crash during the print process if you looked at it wrong, I'd say not too likely -- not with the complexity of the forms you're dealing with.