Consultor Eletrônico



Kbase P24612: How to print an HTML page
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/09/2004
Status: Unverified

GOAL:

How to print an HTML page

GOAL:

How to send a WebSpeed report to a local printer

FACT(s) (Environment):

WebSpeed 3.1D

FIX:

The following is a script example of invoking printing on a client browser. Client side processing such as Printing can only be done using Java or Javascript like code. Progress is Server side processing and has not control over the client application.

<!-- Free JavaScripts at http://www.ScriptBreaker.com -->
<html>
<script language="JavaScript">
DA = (document.all) ? 1 : 0


function handle_error()
{
alert("\nNothing was printed. \n\nIf you do want to print this page, then\nclick on the printer icon in the toolbar above.")
return true;
}
</script>
<body>
<form>
<input type="button" value="Print Page" onClick="window.print();">
</form>

<script language="VBScript">
sub window_onunload
on error resume next
set WB = nothing
on error goto 0
end sub

sub print

OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1


on error resume next

if DA then
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)

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

end if

if err.number <> 0 then
if DA then
alert "Nothing Printed :" & err.number & " : " & err.description
else
handle_error
end if
end if
on error goto 0
end sub


if DA then
wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
else
wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
end if

document.write "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </OBJECT>"
</script>
</body>
</html>


<!-- end Source -->