473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3007
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@_nosp am_start.no> wrote in message
news:Zw******** *********@newss vr21.news.prodi gy.com...
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
2373
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 wont work since the page isnt HTML anymore. Is there some other way to print automaticly. i used to have this function to print automaticly from a browser to client. ------------------
1
2178
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. >From here I want to put a print option in, a button that will either immediately print the contents of the datalist or maybe pop-up something with just the currently viewed datalist contents in it ( leaving the user to print from the browser ).
3
4436
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 component. The problem is that it can't find the div control. Don't know why. I paste the code here: That's in the aspx.vb file: Response.Write("<script>")
1
5704
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 of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me to use the above controls, example 1. The bottom two subroutines will print a graphic file, example...
22
130156
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 document and closes it with the following code: <body onload="window.print(); window.close();"> This works correctly (or at least the way I expect it to work under MS Internet Explorer, but it cuases Netscape to "crash"
9
2724
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 SourceFile As String) As Boolean Try
0
3760
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 problem is that the page is directly printed and i am not getting the option of print preview. How will it possible?Please give me suggestion My code is as follows: code for aspx page <head> <script type="text/javascript">
2
2101
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 print the elements look bigger when I print from IE 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
2
3019
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 prints by using the browser print button then moves to the next one in the session collection. All very tedious but I know no better.
0
8403
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
8737
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...
1
8509
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
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
6174
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
5636
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
4168
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...
1
2735
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
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.