...

View Full Version : printing multiple separate web pages



warrenta
11-01-2008, 12:12 AM
Following fuction attempts to load and print 9 web pages in sequential order. How do I force next sequential page load/focus/print to occur only after previous page has loaded and printing has completed? Is there a way to detect and wait until print() step has ended before proceeding with the next web page?

<script language="javascript">
<!--
function printL01() {
alert('A Total of 9 Web Pages will be Printed!');
window.parent.tspstdleft.location="pdf01note01.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note02.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note03.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note04.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note05.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note06.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01note07.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01exam01.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf01exam02.htm";
window.parent.tspstdleft.focus();
window.parent.tspstdleft.print();

window.parent.tspstdleft.location="pdf00start.htm";
}
// End -->
</script>

shyam
11-01-2008, 05:27 PM
you could add an onload handler but, you can never know if the user accepted the print :/

warrenta
11-04-2008, 07:20 PM
Thanks. I think this may be a solution for me. I have created a printframe.htm frames page that onload executes fillFrame() script to load the requested page that I want to print. It looks like this:

<html>
<head>
<script language="JavaScript">
<!--Begin
var default_page = "stdformsmain.htm";
var content = (location.search) ? location.search.substring(1,location.search.length) : default_page;

function fillFrame() {
url=content
parent.stdprintframemain.location.href=url
}
function printPage() {
window.parent.stdprintframemain.focus();
window.parent.stdprintframemain.print();
}
// End -->
</script>

<script language="javascript">
<!--
function closePage() {
top.window.opener=top;
top.window.open('','_parent','');
top.window.close();
}
// End -->
</script>



</head>

<frameset rows="24,*" onLoad="fillFrame()";>
<frame name="stdprintframeheader" scrolling="no" noresize target="stdprintframemain" src="stdprintbanner.htm" marginwidth="1" marginheight="1">
<frame name="stdprintframemain" marginwidth="1" marginheight="1" scrolling="auto" src="stdprintmain.htm" noresize>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>


</noframes>

</frameset>
</body>

</html>

Right now the banner frame on top provides buttons that will execute a printPage() script to print the loaded page and a closePage() script that will close the frames page parent window. Can I make this automatic? How do I call all three functions: fillFrame();printPage();closePage() sequentially one after the other as part of the onLoad event? Is there an onLoad handler variation that will let me do this? If I can do this I don't need the user to click the print and close buttons in the banner...

A1ien51
11-06-2008, 12:38 AM
Why don't you just generate one document to print? Seems like it would be a lot user friendly.

Eric

warrenta
11-07-2008, 03:08 AM
I need to give my users the opportunity to print selected pages from a library file one at a time. Once he has selected the page I want to do 3 JS tasks in the onload handler: fillFrame();printPage();closePage(). How do I keep the onload handler from trying to execute these 3 tasks all at once?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum