11 Years
Discussion Span
Last Post by achisolomon

I would like to print a Web page in landscape mode. When I use window.print() function it prints default in Potrait mode.

I need to print the Web page in Landscape mode with out asking the user to change the setting.


The JavaScript window.print() method simply passes a print request to the underlying OS, which will bring up a dialog box. The user will select portrait or landscape from that box. In other words, print orientation is up to the user, as it should be in my opinion.


tgreer is right. I agree with tgreer that the user should always be allowed to have control over the print attributes. However, I do wish there was a way that the web developer could indicate printing defaults for a document that then the user could override if they wanted.

There are ActiveX components to do this. (Probably Java applets as well.) I used an ActiveX component once that worked by allowing you to specific things such as the page header and footer, portrait or landscape, etc. The component then saved the user's settings, temporarily changed them, sent your page to the OS for printing, then restored the user's page settings.

Check out http://www.meadroid.com/scriptx/index.asp. It's the component I used before.



I found this code source that can be use to print in landscape mode.

In HEAD tag you must put:

<style type="text/css" media="print">

filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);

After BODY tag you must use a TABLE tag that contais all content of the page:

<TABLE class="page">
... Your page ...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.