CSS Printing Trickery

For past few hours I’ve been fighting with CSS and especially its printed media type. It seems that I’ve found something that actually works better with Internet Explorer than it does with Firefox. Or maybe it’s just me or my printer.

Anyway, when setting absolute positions for elements and using centimetres as unit, there’s an anomaly with Firefox. I developed using Firefox, so after initial tests with Internet Explorer I thought it was behaving badly as well, but soon discovered that IE was working perfectly, and Firefox was not. The problem is that when printing squares with 1cm sides, Firefox actually prints out an approximately 0.6cm by 1cm sized rectangle. IE prints perfect 1cm squares.

For the record, my printer is Lexmark Forms Printer 2480, which also gives out the reason for absolute positioning. And no, PDF is not an option. Fortunately in this case there’s a choice of what browser to use in printing. Because of other reasons, it’ll be Firefox and I’ll be multiplying all horizontal positions by factor of 1.8, while all vertical positions remain unchanged. In any case, if someone wants to go through the trouble of posting this to Bugzilla, that’d be nice. I’m too lazy. 🙂

2 thoughts on “CSS Printing Trickery”

  1. Hi,

    I want a web page print landscape orientation.

    How can I do that in javascript.

    And I tried the code below in css but did not work. Thanks.

    @page {size: landscape; }

  2. Hello. Probably this has to do with browser support, or actually the non-support. Opera does seem to support it, but Internet Explorer and Firefox do not. Maybe this will change in future versions. Hope this helped. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *