Gossamer Forum
Home : General : Internet Technologies :

printing in frames

Quote Reply
printing in frames
I am using the below code to issue a print command on a page that has three frames. There is no toolbar so I create an icon to click on to do the printng. In IE 5.5 and above it will bring up a window print box and allow user to print 'as laid out on screen'. This works good.
In Netscape 6.x it brings up the same box but the options to print 'as laid out' is greyed. I am going to require users to use the latest browser because this is a special application. But I would like to allow both IE and Netscape on the print option. CRTL P works of course but the button is what is required by specs.
This is the code I am using:
<script language="VBScript">
sub window_onunload

on error resume next

' Just tidy up when we leave to be sure we aren't
' keeping instances of the web-browser control in memory
set WB = nothing
end sub

sub print

OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1


on error resume next

'Internet Explorer 4 object has different command structure
if DA then
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER)

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

end if

if err.number <> 0 then
if DA then ' Internet Explorer 4 they probably cancelled
alert "Nothing Printed :" & err.number & " : " & err.description
else
handle_error ' ie3x give alternate instructions
end if
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 Internet Explorer 4 or greater
wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
else
'this must be Internet Explorer 3.x
wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
end if

document.write "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </OBJECT>"
</script>
I call this with my my print button in the top frame. Can someone look and see why Netscape greys out the option or give me a better solution. I don't want to put a print option on each frame and having the user push CRTL P is not permitted in specs.
Any help on this would be great. I hope I posted this in the right place.
The app is DBMAN by the way.
Quote Reply
Re: [thedosmann] printing in frames In reply to
>>
Can someone look and see why Netscape greys out the option or give me a better solution.
<<

vbscript only works with ie.