How do I set printer mode to landscape using javascript?

Posted on 2003-10-23
Last Modified: 2008-03-17

 I want to set the printer mode to landscape while printing my page..
I want to do it throu javascript  How do I do it??
 Can  anybody help me with the code for this...

It is very urgent...

Please help as soon as possible

Thanks  & Best Regards
Question by:ssdanu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

alexgreen earned 500 total points
ID: 9605049
don't think that it's possible sorry! Similar conclusion in

this might give you better background knowledge

there's a possible workaround here

and here your answer may be, if you search through the reams of code

More printer friendly html resources

possibly helpful

scriptx the de facto printing control for the web, developed to provide absolute control over document printing operations from client and server computers running Internet Explorer. A subset of ScriptX printing and script-enhancement functionality is available at no charge and is freely distributable.  possibly the only actual solution to the question.
LVL 15

Expert Comment

ID: 9610885

don't know if this will work, but it's worth a try.  

1) assign the page's content to a variable  
   var contentVar = document.getElementsByTagName('body').innerHTML
(dependent on what you want to print, you may have to use outerHTML or text)

2) which you then send to the following page

3) the init() function will parse the location and fill the div with the passed innerHTML

4) everything in the div will be rotated.

function init()
  txt =
  document.getElementById('theDiv').innerHTML = txt;
<body onload='init()'>
<div id="theDiv" style="position:absolute; top:0px; left:0px; filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1)">
This is some text along with other stuff;
<br />
<table border="1">
<input type='text' value='something'>
</td><td>some  more text</td></tr></table>

LVL 23

Expert Comment

ID: 9638024
It cannot be done, since JS via web pages has no access to the user's local hard drive, which is where the printer settings are stored.
LVL 16

Expert Comment

ID: 10345861
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: alexgreen {http:#9605049}

Please leave any comments here within the next four days.

EE Cleanup Volunteer

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question