Print page, then close?

E

Erik

My main web page has a print button, and when pushed a new page should load,
be printed automatically, and then the page should be closed. The control
should be back at the main page and the user should not have to go through a
print dialog. Is this possible to do in asp.net and/or javascript?
Any help appreciated.
Cheers,
Erik.
 
G

Guest

nope.
They have to get the dialog unless you can print it through the server and
bypass the client.
 
S

S. Justin Gengo

Erik,

The only way to do that would be using some type of active x control or it's
equivalent.

It would be a large security hole if we could just start firing up printers
from any web page.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

sp3d2orbit

I did something similar in an app.

1. The user clicks on a "Print" link.
2. Load the page to be printed, set the onload event to print the
document (window.print())
3. Add a meta tag to do a page refresh back to the main page with no
time delay.

The user will not really see the new page. When the print dialog box
appears the "Print" button should be in focus. That means they won't
have to do anything except hit "Enter" to dismiss the print dialog and
print the document. There is a way of bypassing the print dialog box
altogether, but it involves a lot of c++ coding, downloading code to
the client, and will work only with IE. Short of doing that, the above
steps are your best option.

Matt Furnari
 
E

Erik

1. The user clicks on a "Print" link.
2. Load the page to be printed, set the onload event to print the
document (window.print())
3. Add a meta tag to do a page refresh back to the main page with no
time delay.

Thanks for the suggestions. I think I will use this approach and have the
user hit enter when the print dialog pops up.

Cheers,
Erik.
 
E

Erik

1. The user clicks on a "Print" link.
2. Load the page to be printed, set the onload event to print the
document (window.print())
3. Add a meta tag to do a page refresh back to the main page with no
time delay.

This procedure worked fine, but I have stumbled into another problem:

The "print" page I am using can be reached from many different pages. Using
the meta tag with a static url will require me to make a "print" page for
each of the parent pages. Is there any way to "go back" after the print?

Or, if I launch the "print" page in a new browser window, is there anyway to
close the window after the print is done?

I have experimented with the onafterprint event, but for some reason the
event fires before the print dialog pops up.

Cheers,
Erik.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top