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.

Thanks

Recommended Answers

All 6 Replies

Try asking over in the javascript forum. This is the Java (programming language) forum.

Have asked to have the thread moved.

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.

Maybe this would be of some help to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.