Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: print preview

  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    print preview

    I have found this script in a ton of different discussions and everyone seems very happy with it. It is supposed to open the print preview window, however, I can't get it to do anything. Could it be because I'm on a Mac?

    <script language="javascript">
    function printpr(){
    var OLECMDID = 7;
    /* OLECMDID values:
    * 6 - print
    * 7 - print preview
    * 8 - page setup (for printing)
    * 1 - open window
    * 4 - Save As
    * 10 - properties
    */
    var PROMPT = 2; // 1 PROMPT & 2 DONT PROMPT USER
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(OLECMDID,PROMPT);
    WebBrowser1.outerHTML = "";
    }
    </script>


    Thanks.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    That only works in IE (with enabled ActiveX, I supposed).

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah. Thanks.

  • #4
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Look in the HTML CSS forum, make a different style-sheet for your screen and when people print, screen is horizontal, paper vertical etc, good luck


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •