473,386 Members | 1,720 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,386 software developers and data experts.

Print

Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin
Nov 18 '05 #1
6 1805
you dont unless you want to print it serverside, to a serverside printer.
You can prompt the user for printing but you can't force it, unless possibly
you can get them to install a component or such.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin

Nov 18 '05 #2
You can bring the PrintDialog up with some client side script, but you can't
force them to print it.

window.print()

HTH,

bill
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin

Nov 18 '05 #3
Forced printing would breach the security of the browser unless being done
by a signed applet or activeX control of some sort. It would be a spammers
dream.

The best you can do is invoke the print dialogue via javascript and hope
they print.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin

Nov 18 '05 #4
Thanks guys. Can anybody show me the script to show the print dialog?

Thank you.
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin

Nov 18 '05 #5
Try this

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
<html>
<head>
<script language="VB" runat="server">
'Sub Page_PreRender()

Sub Page_Load( sender as Object,e as EventArgs)

Dim scriptString as String = "<script language=JavaScript> function
DoClick() {"
ScriptString += "var truthBeTold = window.print;"
ScriptString += "if (truthBeTold != null)"
ScriptString += "window.print();"
ScriptString += "else window.alert('Unfortunately, your browser does
not support this shortcut. Please select File and then Print from your
browsers menu.');}<"
scriptString += "/"
scriptString += "script>"

If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<input type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:e0*************@TK2MSFTNGP11.phx.gbl...
Thanks guys. Can anybody show me the script to show the print dialog?

Thank you.
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin


Nov 18 '05 #6
Thanks John.

But in this way, the user has to click on the "Click Me" button to display
the print dialog. I want the print dialog to pop up without the user
clicking on anything (at load).
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl...
Try this

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
<html>
<head>
<script language="VB" runat="server">
'Sub Page_PreRender()

Sub Page_Load( sender as Object,e as EventArgs)

Dim scriptString as String = "<script language=JavaScript> function
DoClick() {"
ScriptString += "var truthBeTold = window.print;"
ScriptString += "if (truthBeTold != null)"
ScriptString += "window.print();"
ScriptString += "else window.alert('Unfortunately, your browser does not support this shortcut. Please select File and then Print from your
browsers menu.');}<"
scriptString += "/"
scriptString += "script>"

If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<input type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:e0*************@TK2MSFTNGP11.phx.gbl...
Thanks guys. Can anybody show me the script to show the print dialog?

Thank you.
"Catalin Porancea" <ca**************@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

How do I print a web form as soon as it is displayed, without any user
intervention?

Thank you,
Catalin



Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
0
by: bearophileHUGS | last post by:
There is/was a long discussion about the replacement for print in Python 3.0 (I don't know if this discussion is finished): http://mail.python.org/pipermail/python-dev/2005-September/055968.html ...
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...
1
by: Steff | last post by:
I am wandering if my code is making sense... I use a lot the print function. Is it weird in this case where I have to display an array ? I thought it would be better to have the entire array in php...
3
by: James J. Besemer | last post by:
I would like to champion a proposed enhancement to Python. I describe the basic idea below, in order to gage community interest. Right now, it's only an idea, and I'm sure there's room for...
69
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
7
by: samslists | last post by:
Am I the only one that thinks this would be useful? :) I'd really like to be able to use python 3.0's print statement in 2.x. Is this at least being considered as an option for 2.6? It seems...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.