473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

tsubasa
64
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

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.  
  3. function approveorder()
  4. {
  5.  
  6. if(box1.checked == false)
  7.  
  8. { alert('Please confirm Statement of Review!'); }
  9.  
  10. window.print()
  11.  
  12. if (print.closed == true)
  13.  
  14.  
  15. { alert('Printing complete!'); }
  16.  
  17. <!-- Command that will execute to close the order goes here!
  18.  
  19. }
  20.  
  21. </script>
Aug 19 '10 #1

✓ answered by gits

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.

3 3696
gits
5,390 Expert Mod 4TB
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.
Aug 19 '10 #2
tsubasa
64
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.

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

-Tsu
Aug 20 '10 #3
gits
5,390 Expert Mod 4TB
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 ...
Aug 20 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: rodchar | last post by:
hey all, is there a way to bring up the printer dialog (File/Print) thru code in asp.net? thanks, rodchar
1
by: Tommy Martin | last post by:
I would like to bring up the printer dialog before my report is sent to the printer to allow the user to select another destination and possibly the number of copies. Can anyone steer me in the...
11
by: pamelafluente | last post by:
I am doing my own PrintDialog, and have placed there a combo with the printer names, as in the PrintDialog provided by VB.NET. Here is the question: how do I open the native windows printer...
1
by: Haobing | last post by:
I embeded an flash activex control to a wxPanel inherited class 'MyPanel' using wxPython's MakeActiveXClass method, and 'MyPanel' only has flash control ;But when then dialog init,the focus is not...
5
by: Diego | last post by:
How do I capture a cancel event of Printer dialog box? Regards, Diego
1
by: Tim Marshall | last post by:
A2003 Most of the time, in past apps, my report routines are usually a preview first and then DoCmd.RunCommand acCmdPrint for the printer dialog. However, I'm now faced with wanting to send a...
21
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. ...
2
by: Chris | last post by:
Hi, i wrote this code for fetching data from a table using a stored procedure. The connection definition and opening are put in a class. The actual read of data occurs in code-behind. My...
2
by: jlparise | last post by:
Hey everyone, I am really rusty on my Java socket programming and am having some confusing problems. I don't need the code debugged(even though it doesn't work). I'm not going to make you dig...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.