How can I tell when the Printer Dialog has closed after printing?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tsubasa
    New Member
    • Aug 2008
    • 64

    #1

    How can I tell when the Printer Dialog has closed after printing?

    I am working on a web page that allows a user to review orders that are pending approval. If the user approves the order it will print the order then run an asp page to close the order after it has been printed. How can I check to see if the printer dialog box has closed so that I can execute the next command. Thanks in advance!

    -Tsu

    Code:
    <script language="JavaScript">
    
    function approveorder()
    {
    
    if(box1.checked == false)
    
    { alert('Please confirm Statement of Review!'); }
    
    window.print()
    
    if (print.closed == true)
    
    
    { alert('Printing complete!'); }
    
    <!-- Command that will execute to close the order goes here!
    
    }
    	
    </script>
    Last edited by Dormilich; Aug 19 '10, 07:35 AM. Reason: Please use [code] tags when posting code
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    basically you cannot capture that event in a crossbrowser manner for a public page. in an intrnet you could have more control about the browser's security settings - then some ActiveX for IE or mozilla's internal components could help - but as i said and you might see from the two examples ... that is no real option for a public page, since both would require enhanced security privileges.

    Comment

    • tsubasa
      New Member
      • Aug 2008
      • 64

      #3
      Hi Gits,

      The reason I wanted to to capture the event was to find a way to print without the print dialog box. Many have said that it could not be done, but after some more research on the Internet. I found the VBScript and the Javascript that will allow for this. See below.

      Code:
      <script language='VBScript'>
      Sub Print()
             OLECMDID_PRINT = 6
             OLECMDEXECOPT_DONTPROMPTUSER = 2
             OLECMDEXECOPT_PROMPTUSER = 1
             call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
      End Sub
      document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
      </script>
      After including this code, I just used the typical window.print(); command print off my web page without the dialog box.

      -Tsu

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        it is an IE only solution of course - in case you want to use it check whether this will work with standard IE security settings ...

        Comment

        Working...