How to automatically print an asp web page in landscape

Posted on 2011-10-05
Last Modified: 2012-05-12
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
Question by:klwn
    LVL 12

    Accepted Solution

    <head runat="server">
    <style type="text/css" media="print">
         display: none;
     width: 100%;
     height: 100%;
     margin: 0% 0% 0% 0%;
     filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
     page-break-before: always;
    <body class="landScape">
        <form id="form1" runat="server">
     This is some content to print
    LVL 41

    Expert Comment

    or just
    @page {size: 8.5in 11in landscape}

    Author Closing Comment

    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.

    Author Comment

    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

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now