38

The CSS rule

@page {size: landscape;}

is supposed to force browsers to print pages in landscape mode. This rule is mentioned in many questions on stackoverflow, on many other programming sites, and in reference works such as O'Reilly's HTML/XTHML The Definitive Guide, Fifth Edition.

I've tried to using this CSS rule with many different format tweaks with both inline styles and linked style sheets, specifying media and not specifying media, with IE8, Chrome 7.0, and Firefox 3.6. I've tried printing to a Xerox Phaser 8560 and to the Adobe PDF print driver. All of my testing has been done on Windows Vista Ultimate 64 bit.

I have never see this CSS rule actually work, i.e. I've never seen a page print landscape on any attempt. Admittedly I haven't done really thorough QA on this, since I've only tried 2 printer drivers and one OS.

Have you actually seen this rule work for a browser, OS, and printer configuration? There is some mention in other questions on this topic that the rule is not broadly supported. Since I can't get it to work on my development machine at all I am wondering when, if ever, does it work? It would help to get specifics on browser, OS, and printer combinations that are known to work, or to confirm that this is a waste of time.

Paul Keister
  • 12,851
  • 5
  • 46
  • 75
  • 1
    See also: http://stackoverflow.com/questions/138422/landscape-printing-from-html/ – John Nov 24 '11 at 08:45

1 Answers1

27

CSS 2.1 no longer specifies the size attribute. The current working draft for CSS3 Paged Media module does specify it (but this is not standard or accepted). I have not been able to find a report of specific browser/version support, but I get the sense that it is poorly supported (perhaps only by Opera?).

Phrogz
  • 296,393
  • 112
  • 651
  • 745
  • 6
    Thanks very much; I particularly appreciate the link in your comment above. Sometimes the most helpful thing is to know that what you are attempting is impossible. – Paul Keister Nov 22 '10 at 22:20