locked
Silent Print From Client side IE RRS feed

  • Question

  • Hi,


    I tried print pdf from browser via javascript.

    it prints with dialog box . i tried to skip this dialog box but failed in doing so.

    i tried several codes like

    1 -- // this also opens dialog box

      

    function print1()
    {
    if (navigator.appname == "microsoft internet explore")
    {
    var printcommand = '<object id="printcommandobject" width=0 height=0 classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2"></object>';
    document.body.insertadjacenthtml('beforeend', printcommand);
     document.all.printcommandobject.execwb(6,-1);
    printcommandobject.outerhtml = "";
    }
    else {
    window.print();
    }
    }
    </script>

    <button onclick=print1()>Try it</button>

    2-this is second code which i tried

    <script>
    function btn_print_onclick() {
      factory.printing.header = "This is MeadCo";
      factory.printing.footer = "Printing by ScriptX";
      factory.printing.portrait = false;
      factory.printing.leftMargin = 1.0;
      factory.printing.topMargin = 1.0;
      factory.printing.rightMargin = 1.0;
      factory.printing.bottomMargin = 1.0;
      factory.printing.Print(false);
    }
    </script>

        
    </head>
    <body>
       <button onclick="btn_print_onclick()">Print report</button>
    </body>

    3 - also tried some links but they also didn't work for me

    http://forums.asp.net/t/1364879.aspx?Avoid+Print+dialog+box+while+printing+webpage

    http://www.webdeveloper.com/forum/showthread.php?174029.html

    http://justtalkaboutweb.com/2008/05/09/javascript-print-bypass-printer-dialog-in-ie-and-firefox/

    http://scriptx.meadroid.com/community-support/community-forum/general/2014/1/the-problem-of-scriptx-in-ie8.aspx


    http://codeverge.com/asp.net.getting-started/avoid-print-dialog-box-while-printing/726740

    https://gist.github.com/cchitsiang/7349218

    http://www.codeproject.com/Questions/784656/Printing-in-one-click-I-dont-want-print-setup-dial

    any help will be appreciated.

    Thanks

    Sushil

    Monday, July 27, 2015 5:08 PM

Answers

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Visio that one suit of MS Office, I recommend you post the question to the MSDN forum for JS

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=jscript

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=netfxjscript

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    • Proposed as answer by George123345 Thursday, August 6, 2015 4:48 AM
    • Marked as answer by George123345 Thursday, August 6, 2015 4:49 AM
    Tuesday, July 28, 2015 2:12 AM