in Search
     
Latest post 01-10-2007 6:27 PM by modchip. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-08-2007 1:31 AM

    • ladyannebug
    • Top 75 Contributor
    • Joined on 11-07-2006
    • taguig, phils
    • Posts 15
    • Points 485

    How to set landscape orientation in css/javascript?

    Hi guys!  Can somebody give me a code to print in landscape orientation that WORKS in IE, may it be in css or in javascript code?  So that the user need not to set it in the Page Setup dialog box..

    Ive tried codes such as: 
    1
    @page land {size: landscape;}
        -but seems it doesn't work in IE

    1
    .land{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1)}
        -this one works but its a kind of an image-printing that wouldn't give you your page's exact look, plus some details are not included in the print..

    TIA!  Any suggestion will be appreciated.

    The most likely way for the world to be destroyed is by accident. That's where we come in: We're computer professionals, we cause accidents!
    • Post Points: 20
  • 01-09-2007 8:34 PM In reply to

    • modchip
    • Top 10 Contributor
    • Joined on 02-09-2006
    • Ivalice
    • Posts 710
    • Points 10,110

    Re: How to set landscape orientation in css/javascript?

    I've once used an ActiveX control called WScript... which makes the computer think that the user is typing something You can use this to simulate a user setting his/her printing preferences to landscape. I don't have the code now, but I'm sure there are references to this scattered around. Try searching for it. I'm not sure if it works for IE7 though. Good luck.

    • Post Points: 20
  • 01-10-2007 5:39 PM In reply to

    • ladyannebug
    • Top 75 Contributor
    • Joined on 11-07-2006
    • taguig, phils
    • Posts 15
    • Points 485

    Re: How to set landscape orientation in css/javascript?

    gee thanks.. it worked.. ive searched for some codes, and here's what i got..

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <script language="javascript" type="text/javascript">

    var shell = new ActiveXObject("WScript.Shell");

    function SetPrintProperties() {
    try {
    window.setTimeout("BLOCKED SCRIPTshell.SendKeys('%fu');",1);
    window.setTimeout("BLOCKED SCRIPTSetPaperSize();", 1);
    print();
    } catch (e) {
    alert ("An exception occured: " + e + "\nCode is: " + e.number + "\nDescription is: " + e.description);
    alert('Please verify that your print settings have a Landscape orientation and minimum margins.');
    }
    }

    function SetPaperSize() {
    shell.sendKeys("%a{TAB}.2{TAB}0{TAB}0{TAB}0{ENTER}");
    }

    SetPrintProperties();

    </script>

    thanks modchip! you're an angel.. Devil


    The most likely way for the world to be destroyed is by accident. That's where we come in: We're computer professionals, we cause accidents!
    • Post Points: 20
  • 01-10-2007 6:27 PM In reply to

    • modchip
    • Top 10 Contributor
    • Joined on 02-09-2006
    • Ivalice
    • Posts 710
    • Points 10,110

    Re: How to set landscape orientation in css/javascript?

    Glad it worked out fine for you. Thanks. Wilted Flower

    • Post Points: 5
Page 1 of 1 (4 items)