Hiya,
Can anyone help me with a problem I'm having printing a page which contains a frameset, which in turn contains a number of frames. I want to print the frames "As Laid Out On Page", as it were, but I can only seem to print either the active frame or all the frames separately.
Here's the pertinent bits of script I'm using to get as far as I've got;
<SCRIPT LANGUAGE="JavaScript">
<!--
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac" != -1);
function printPage(frame, arg) {
if (frame == window) {
printThis();
} else {
link = arg; // a global variable
printFrame(frame);
}
return false;
}
function printThis() {
if (pr) { // NS4, IE5
window.print();
} else if (da && !mac) { // IE4 (Windows)
vbPrintPage();
} else { // other browsers
alert("Sorry, your browser doesn't support this feature."
}
}
function printFrame(frame) {
if (pr && da) { // IE5
frame.focus();
window.print();
link.focus();
} else if (pr) { // NS4
frame.print();
} else if (da && !mac) { // IE4 (Windows)
frame.focus();
setTimeout("vbPrintPage(); link.focus();", 100);
} else { // other browsers
alert("Sorry, your browser doesn't support this feature."
}
}
if (da && !pr && !mac) with (document) {
writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
writeln('Sub window_onunload');
writeln(' On Error Resume Next');
writeln(' Set WB = nothing');
writeln('End Sub');
writeln('Sub vbPrintPage');
writeln(' OLECMDID_PRINT = 6');
writeln(' OLECMDEXECOPT_DONTPROMPTUSER = 2');
writeln(' OLECMDEXECOPT_PROMPTUSER = 1');
writeln(' On Error Resume Next');
writeln(' WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
writeln('End Sub');
writeln('<' + '/SCRIPT>');
}
function closeTheWindow() {
document.close();
window.close();
parent.close();
}
// -->
</SCRIPT>
Then an image with the following attached to it;
OnClick="printPage(parent, this)"
This'll print all the frames on the page individually - is there any way to make the frames print as they're laid out on the screen?
Any help will be much appreciated,
Thanks,
Paul
Can anyone help me with a problem I'm having printing a page which contains a frameset, which in turn contains a number of frames. I want to print the frames "As Laid Out On Page", as it were, but I can only seem to print either the active frame or all the frames separately.
Here's the pertinent bits of script I'm using to get as far as I've got;
<SCRIPT LANGUAGE="JavaScript">
<!--
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac" != -1);
function printPage(frame, arg) {
if (frame == window) {
printThis();
} else {
link = arg; // a global variable
printFrame(frame);
}
return false;
}
function printThis() {
if (pr) { // NS4, IE5
window.print();
} else if (da && !mac) { // IE4 (Windows)
vbPrintPage();
} else { // other browsers
alert("Sorry, your browser doesn't support this feature."
}
}
function printFrame(frame) {
if (pr && da) { // IE5
frame.focus();
window.print();
link.focus();
} else if (pr) { // NS4
frame.print();
} else if (da && !mac) { // IE4 (Windows)
frame.focus();
setTimeout("vbPrintPage(); link.focus();", 100);
} else { // other browsers
alert("Sorry, your browser doesn't support this feature."
}
}
if (da && !pr && !mac) with (document) {
writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
writeln('Sub window_onunload');
writeln(' On Error Resume Next');
writeln(' Set WB = nothing');
writeln('End Sub');
writeln('Sub vbPrintPage');
writeln(' OLECMDID_PRINT = 6');
writeln(' OLECMDEXECOPT_DONTPROMPTUSER = 2');
writeln(' OLECMDEXECOPT_PROMPTUSER = 1');
writeln(' On Error Resume Next');
writeln(' WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
writeln('End Sub');
writeln('<' + '/SCRIPT>');
}
function closeTheWindow() {
document.close();
window.close();
parent.close();
}
// -->
</SCRIPT>
Then an image with the following attached to it;
OnClick="printPage(parent, this)"
This'll print all the frames on the page individually - is there any way to make the frames print as they're laid out on the screen?
Any help will be much appreciated,
Thanks,
Paul