Problem solve Get help with specific problems with your technologies, process and projects.

Printing 'landscape' as an ASP.NET Web Form button click event

ASP.NET (code behind VB.NET)

Is there a printer-friendly method that will set the Printer Layout Orientation mode to "Landscape" for an ASP.NET Web Form button click event?
Printing depends on the browser. Your code-behind can do nothing about it. Neither can your JavaScript (AFAIK). There are some very dirty hacks, mostly based on sending misterious WM_ messages to windows and the like, but beware: they may stop working without notice with any Windows release! And they're not even guaranteed to work across all versions either...

Someday, all browsers will fully support the new CSS standards (https://www.w3.org/Style/CSS/), and you will be able to control all aspects of printing with a simple stylesheet attached to media:print.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.