How to automatically print an asp web page in landscape

Hi All,

I wonder if anyone can help? I have a website setup in ASP.NET and one of the pages contains a report which internal users will need to print in landscape. When you select print, the default is to print in portrait. Is there a script or piece of code which can be used to allow the user to automatically print this page in landscape without having to change it themseleves within the print menu?

Many thanks,
Amy Downing
klwnAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ramkisan JagtapLead DeveloperCommented:
<head runat="server">
    <title>Default3</title>
<style type="text/css" media="print">
.noDisplay
{
}
.noPrint
{
     display: none;
}
.landScape
{
 width: 100%;
 height: 100%;
 margin: 0% 0% 0% 0%;
 filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
}
.pageBreak
{
 page-break-before: always;
}
</style>
</head>
<body class="landScape">
    <form id="form1" runat="server">
    <div>
 This is some content to print
    </div>
    </form>
</body>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
grayeCommented:
or just
@page {size: 8.5in 11in landscape}
klwnAuthor Commented:
This solution was a great help, thank you. We placed the code within the body of our stylesheet and this worked. We did however get the following error when hovering over the filter property - 'filter is not a known css property name' when using Visual Web Developer 2008 - Express Edition. After researching this error, we found that this is only an issue if you are using any other browser other than Internet Explorer. As our solution is for an internal intranet of which Internet Explorer is used, this isn't currently an issue for us.
klwnAuthor Commented:
Hi All,
We have an additional query to the above solution. Can the headers / footers be removed from the report as these are still printing in portrait? The body of the report is fine and printing in landscape as required.

Many thanks,
Amy Downing
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.