You must Sign In to post a response.
  • Category: HTML

    How to Print from browser without print popup window


    Are you looking for a way to Print from browser without print popup window ? then read this thread to know more about it



    I have Oracle v11 and I have a single PL/SQL scripts, as the internet application
    I'm using window.print() for printing

    I would like to print directly from browser without print popup window
    I have own procedures for testing, but no success, it not work

    The following is a test case!

    Can only help me to solve this problems

    Regards!

    Hine

    CREATE OR REPLACE PROCEDURE TEST_PRINT
    AS
    begin
    htp.prn('<!DOCTYPE html>
    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <script type="text/javascript">
    var PrintCommandObject = null;
    function printPage(){
    if (PrintCommandObject)
    {
    try{
    PrintCommandObject.ExecWB(6, 2);
    PrintCommandObject.outerHTML = "";
    }
    catch(e){
    alert(e);
    window.print();
    }
    }
    else{ window.print(); }
    }
    </script>
    <title>PrintPage</title>
    </head>
    <body>
    <object id="PrintCommandObject" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" width="0" height="0"></object>
    <button type="button" onclick="printPage()">Print</button>
    </body>
    </html>');
    end;
  • #748322
    I think following javascript code snippet will work for you

    <script language="Javascript">
    if (navigator.appName == "Microsoft Internet Explorer")
    {
    var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0
    CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
    PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
    }
    else {
    window.print();
    }
    </script>

    hope it helps

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #748365
    hi,

    since you are using window.print, so please try this, it will help you-

    <SCRIPT LANGUAGE="JavaScript">
    if (window.print) {
    document.write('<form><input type=button name=print value="Print" onClick="window.print()"></form>');
    }
    </script>

    For more details, please go through this article-

    http://www.htmlgoodies.com/beyond/javascript/article.php/3471121

    Thanks,
    Ashutosh Jha
    http://tricksroad.com

  • #748401
    Stackoverflow.com/questions/11391178/window-print-without-opening-the-print-window

    you can try to follow what is mentioned in the above link or you can also use PrintDocument class in c# to print a document without showing the print dialog window as a pop up.

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net


  • Sign In to post your comments