View Full Version : Auto Print...... Help!
Smart_boy
05-16-2007, 09:48 AM
hello.... i'm asking to write a system that can auto print the webpage without pop up any dialog box.
the problem is i totally not idea what source code can i use to write for it.
if i writing this system by using HTML + javascript, can i success to done it?
if can, how to write the coding of html to run it? can teach me how to do it?
i'm really headache about this task. hope can gets some from you all here.
Thanks.................:)
boogyman
05-16-2007, 01:15 PM
file > print in your browser window. if you are looking to add a link to a page that they can click on to print, I believe its something like
<a href="javascript:print()">Print Page</a>
codeexploiter
05-16-2007, 01:26 PM
Insert the following code into your <head> once the your page loads completely it will start the printing automatically.
<script type="text/javascript">
window.onload = function() {
window.print();
}
</script>
mburt
05-16-2007, 07:11 PM
Watch out for overwriting onload event handlers, for example:
function abc() {};
function xprint() {window.print();}
window.onload = abc;xprint;
Add a semicolen after each function, if needed.
I think you all missed the key criterion:
without pop up any dialog box.This can't be done. It may be possible with Java or ActiveX, but then you'd have a dialogue for that instead.
mburt, that's equivalent to:
window.onload = abc;
xprint;You mean:
window.onload = function() {
abc();
xprint();
};
Smart_boy
05-17-2007, 02:52 AM
<script type="text/javascript">
window.onload = function() {
window.print();
}
</script>
what is the purpose and why must write the window.onload....
can i direct write the window.print()?
i try already but i still can run.
Smart_boy
05-17-2007, 03:06 AM
I think you all missed the key criterion:This can't be done. It may be possible with Javascript or ActiveX, but then you'd have a dialogue for that instead.
Thread:
it's really can't done by using html and javascript?:eek:
Then do u have any suggestion of the coding to me so that can auto print the webpage without have pop up any dialog box or dialogue for that instead.
Thanks.........!!
boxxertrumps
05-17-2007, 03:14 AM
Please don't, you'll (for lack of a better expression) piss off your users.
If this is meant for your school/buisness/etc, then having the dialouge box isn't that bad, its only an extra click.
It's simply not possible. No matter what you try, some kind of dialogue will be involved at least once.
codeexploiter
05-17-2007, 01:39 PM
If you are trying to bypass the Printer Dialogbox then Twey is absolutely correct it is impossible; you won't be able to bypass the printer option dialogbox. I think this is some kind of security restriction otherwise If I want I can make my website users printer working without much trouble.
I wonder what you are trying to achieve in this case? If you provide a print link then your users need to take a printout they can do that. Why do you insisting on taking your page's printout?
what is the purpose and why must write the window.onload....
can i direct write the window.print()?
You are correct but in my approach only after loading the complete window content the printing will start.
Smart_boy
05-21-2007, 08:33 AM
Twey, codeexploiter, thanks a lots of you that share yours opinion at here to me.
Yes. it's impossible to done it by using html. whatever how many time and effort to try it, also can't achieve. Sad!!
i heard that my senior said that it can do it in IE [window xp (sp1)] before this by using the javascript. but it's can't function any more now when the window upgrade to sp2. i think may be this is some kind of security restriction.
i plan to solve it by using the C++.
Twey, codeexploiter, from yours experience and knowledge. Do you feel that it can solve by C++? If this impossible, then i don't want waste time to solve it already.
Thanks......!!
codeexploiter
05-21-2007, 09:01 AM
Do you feel that it can solve by C++?
You may be able to solve this problem (overriding of printer dialog box) using C++ but that is not the real issue here.
You are trying to do something without your users permission with their resources. You just think from their point of view about the whole issue. If they want to take a printout provide something through which they can take printout.
As a user I won't be much happy if an auto print starts even without I start reading the content of the page.
tech_support
05-21-2007, 09:07 AM
As a user I won't be much happy if an auto print starts even without I start reading the content of the page.
You could always just turn off the printer ;)
codeexploiter
05-21-2007, 09:10 AM
You could always just turn off the printer
It may not be always possible as I am not expecting any auto printing kind of activities if I am visiting a website.
It would be better if we define the objective of a website.
tech_support
05-21-2007, 09:35 AM
Just like when you're not expecting any viruses entering from a website :p
i plan to solve it by using the C++.
Twey, codeexploiter, from yours experience and knowledge. Do you feel that it can solve by C++?Yes, but abandon all hope of embedding it into a webpage (without a dialogue box). It'd have to be a standalone program running on the user's computer.
boxxertrumps
05-22-2007, 02:46 AM
Just like when you're not expecting any viruses entering from a website :p
It's why we dont like IE...
Smart_boy
05-23-2007, 06:53 AM
anyway, really thanks a lots of yours helping at here. (n_n)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.