Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a way to automate a window.print, no user interaction

Status
Not open for further replies.

joemadera

Technical User
Jun 27, 2006
14
0
0
US
Hello,

What I have is this:

A web page for an internal order form. Currently users click the SUBMIT button to send the job to the printer. I currently use the Window.Print to bring up the print dialog box. I am looking for another way where the user does not have to actually click "Print" on the print dialog box.

When the user gets to this page I record thier current default printer, add this new network printer and set it as default then - window.print. After they print I add back their old default printer and remove the submission printer I had just added. What I wanted to do is to take the step out of having them to actually click print.

I saw something a few months ago about an activex component that could handle this, but I can not find anything about it now.

Any ideas would be appreciated.

Thanks,
 
This is what we do to handle the same thing. Place this code in the page you want to print. It will load the page and bring up the windows control to select a printer.

<script language="javascript">
<!--

function myprint() {
window.print();
}


<body onload="myprint()">
 
Hi and thanks MZimbaro..

I am looking for a way to "take away" the option of the user selecting the printer. I want to send the job to the default printer automatically..sort of wrap up the window.print function to run this without user interaction.
Let me clarify, it does not need to be the default if there is a way to do this to another networked printer. I am using the default because window.print starts with that selected. If I can scratch the code of adding the new printer, setting it as default, I will. But that was the only way I could get it to run currently..I just forsee problems with user having a choice of either following direction to just click print, or accidently selecting another printer and then "print". I could remove all installed printers and add them back after, but I really just want to find a way to submit the print job in the background via my script. I thought about printing to a file then sending that to the printer..I haven't tried that but it feels clunky..

Thanks
 
I have an update on this. I found that old function to do this.

WBControl.ExecWB

Now my only problem is getting that to execute correctly, if I use it in my data access page it gives an error that it doesn't support that method..I can get it to run with a test html page and a form, so I might have to just use it in an asp..

if anyone has any idea's or experience using this, all help much appreciated.

thanks again
 
Not from _within_ the page. The popup won't be bypassed from there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top