Hi All,
I have a webpage written in c# asp.net. The page has a datagrid and a print button. The print button has the javascript onclick="javascript:window.print();"

I want to be able to change the print preference to LandScape.
I tried using CSS but because I have a datagrid its not working. CSS works if I don't have the datagrid.
This is kinda urgent.


That attribute does not belong to the web designer. It belongs to the owner of the computer that is displaying the web page. It's in his printer settings on his hard disk. It is an Internet security violation for a web page to change the internal settings on a user's computer.

Think of the lost business time a user might incur if his printer orientation is suddenly changed without his knowledge. He might print twenty documents, and then walk over to the printer and
find that he has to print all of them again. A certain basketball coach might throw the printer across the room.

IE has a nonstandard way to change the print orientation from a website (and puts it back after the user leaves that site), but it doesn't work on other browsers.

Just ask the user to make the setting change before printing.

This is an internal site and the users them selves want it. IE is the only browser they use.

I don't know the code to do that. Note that it will not work with strict doctypes.

Normally the portrait/landscape setting is stored in a document, or (in the case of a web browser) is set as a default.

This article has been dead for over six months. Start a new discussion instead.