473,395 Members | 2,423 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,395 software developers and data experts.

Print page, then close?

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
5 2994
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
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
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
> 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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard | last post by:
in a previous aspx page i got a few records printed throu window.print() function in javascript. but now i have the records in a to RTF and i want to run the same function print, which ofcourse...
1
by: yer darn tootin | last post by:
Ahoy, I have an aspx web page that loads an ascx control that's populated with various items ( in a datalist ). Select an item and the page reloads and the datalist now shows the details. ...
3
by: Diego F. | last post by:
Hello. I'm trying to call a function that prints the content of a div element. I had that javascript code working, but now I must put that code in the server side, as it is called from another...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
9
by: Scott M | last post by:
I'm printing a directory of about 500 multi-page tifs to a high speed printer and the spooler process is killing me!!! here is a little code..... Public Function PrintImage(ByVal...
0
by: agarwalsunitadhn | last post by:
hi.. How will i use print and print preview option. I have to print only a part of a page. for that i declare in a div and give that a id and then using java function to print that portion but my...
2
by: dmorand | last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I...
2
by: bob | last post by:
Hi, I have a page that has a collection of things which it passes to a second 'print' page using a session variable. The print page has buttons for moving though the collection and the user ...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.