473,756 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

tsubasa
64 New Member
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
3 3717
gits
5,390 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Moderator Expert
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
1285
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
1476
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 right direction? Thanks in advance. Tommy
11
9897
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 dialog for the current printer, so that my current PrintDocument.PrinterSettings will be set according to the User choices ? Thanks -Pamela
1
1890
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 on the flash, I have to click the flash control manully to setfocus on it; It will lose focus again when the dialog is block by other windows, so I have to click again to pull the focus back. I just want to know howto SetFocus to an activex...
5
3347
by: Diego | last post by:
How do I capture a cancel event of Printer dialog box? Regards, Diego
1
4157
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 report to a printer of choice withoutthe preview. I'm aware of Albert Kallal's snippet of code that allows you to change the default printer, but I'm wondering if there's any other way?
21
18176
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. This has been fine until last week when I started getting javascript 'Permission Denied' errors when I try to access this property. I suspect that a windows update has caused this somehow, as this code has not changed for a very long time. Can...
2
6941
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 problem with this code: Invalid attempt to Read when reader is closed at line: While dtreader.Read() Thanks for help
2
10516
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 through all the abstraction layers and such. Anyways here is my issue. The application sends a request for data to the server and the server responds. However, the server then sends a TCP Fin message to close the connection which I can see through...
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.