By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,011 Members | 1,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,011 IT Pros & Developers. It's quick & easy.

Print page, then close?

P: n/a
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.
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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
"Erik" <eransoft@_nospam_start.no> wrote in message
news:Zw*****************@newssvr21.news.prodigy.co m...
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.

Nov 19 '05 #2

P: n/a
nope.
They have to get the dialog unless you can print it through the server and
bypass the client.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Erik" wrote:
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.

Nov 19 '05 #3

P: n/a
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

Nov 19 '05 #4

P: n/a
> 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.
Nov 19 '05 #5

P: n/a
> 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.
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.