Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Sending ASP Output to printer. Posted by ssvasan on 16 Oct 2003 at 2:08 AM
I want to send ASP outputs directly to printer, without displaying in browser. How can I do this ?

Report
Re: Sending ASP Output to printer. Posted by lillu on 16 Oct 2003 at 3:24 AM
Printing happens on the CLIENT. Therefore, you can only control anything to do with printing, from the client and not from ASP. Print settings, initiating the printer can only be triggered from the CLIENT side. Use JavaScript, JScript or CSS to control the Print dialog.
BTW, I heard there's a way of setting the print dialog not to come up though.


: I want to send ASP outputs directly to printer, without displaying in browser. How can I do this ?
:
:


To err is human, but to really foul things up requires a computer. (Farmers Almanac)

Report
Re: Sending ASP Output to printer. Posted by ssvasan on 16 Oct 2003 at 3:50 AM
This message was edited by ssvasan at 2003-10-16 3:52:32

Just as displaying output in the Monitor as a softcopy, I want to print it to get a hard copy. Instead of sending to Monitor I want to send to the printer, Printer also a resource on the network, can we build any URL for a printer on a network. We are engaged doing a courier service project, this printing matter only to our private use and will be applied to our offices in different cities in INDIA only.



: Printing happens on the CLIENT. Therefore, you can only control anything to do with printing, from the client and not from ASP. Print settings, initiating the printer can only be triggered from the CLIENT side. Use JavaScript, JScript or CSS to control the Print dialog.
: BTW, I heard there's a way of setting the print dialog not to come up though.
:
:
: : I want to send ASP outputs directly to printer, without displaying in browser. How can I do this ?
: :
: :
:
:
To err is human, but to really foul things up requires a computer. (Farmers Almanac)
:
:



Report
Re: Sending ASP Output to printer. Posted by Manning on 16 Oct 2003 at 8:50 AM
: I want to send ASP outputs directly to printer, without displaying in browser. How can I do this ?


Unless your printer has the ability to load up a webpage and print what it is sent, you can't. ASP is done through a web server and some sort of client, so the printing has to be handled on the client side (as someone already pointed out).

You might be able to do what you want by using VBScript and the Windows Scripting Host interpreter (CScript.exe or WScript.exe), but I can't say for sure.
Report
Re: Sending ASP Output to printer. Posted by ChipHead on 16 Jul 2009 at 10:34 AM
Using ASP and IE8 Here is what has worked for me. This will print as soon as the page loads. Good luck! Nothing fancy...


<body onload="window.print();">

<OBJECT Classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0></OBJECT>



<SCRIPT LANGUAGE="JavaScript">

DA = (document.all) ? 1 : 0

</SCRIPT>

<SCRIPT LANGUAGE="VBScript">

sub print()



OLECMDID_PRINT = 6

OLECMDEXECOPT_DONTPROMPTUSER = 2

OLECMDEXECOPT_PROMPTUSER = 1



'on error resume next



'IE4 object has different command structure

if DA then

call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)



else

call WB.IOleCommandTarget.Exec(OLECMDID_PRINT ,OLECMDEXECOPT_DONTPROMPTUSER,"","")



end if



end sub



'This will be interpreted during loading.

'It will write out the correct webbrowser object depending

'on the browser version. To be sure it works, make sure you

'include this script block in between the body tags.



if DA then

'this must be IE4 or greater

wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"

else

'this must be IE3.x

wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"

end if



document.write ""

</SCRIPT>





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.