View Full Version : How to print multiple html documents ?

07-10-2004, 12:13 AM

I have set of html documents on the server (in the DB) and I need to print them all as the one print job.
(my question is not about server side programming)
I tried to merge documents and make one page of multiple html docs and
and request them from a window to call window.print() then.
IE and NS browsers show such a 'document' but since it is a one window
background gets same for all documents.
Then I tried to put them into separate frames and iframes but all didn't work.

How to do it ?



07-10-2004, 05:40 AM
what activates the print statement? is it a link? i.e "Print XYZ"

FYI: to my knowledge you CAN do this fairly easily. it requires a javascript code (which i think i have somewhere, lemme go look)


07-10-2004, 05:48 AM
okay. in all honesty my way wont work for you.

i have a link on one page that prints another URL... but for multiple documents at once you'd need a JS script... which could be handy for me as well. i hope someone gives you one.

heres what i did:
on the url "linecard.html", i have a link called

<a href="print_linecard.html" onClick="window.print();return false;"

and in the head i have

<link rel=alternate media=print href="print_linecard.html">

basically i think you'll need a javascript that will take multiple arguments at once, with an activation statement like
... printMultiple('link1.html', 'link2.html', 'link3.html', etc)

07-10-2004, 11:09 PM

I decided to put each of the urls to html pages (that I need to print) to the separate IFRAMEs. So I have now complete document containing multiple pages inside, for printing.
But now I need to determine correct size of the document in each iframe to resize them (iframes) to height/width of the document.

<script language="JavaScript">
function SetFullSize()
var frame1 = window.document.getElementById("frame1");
//window.document.body.style.height = frame1.height + frame2.height;
frame1.height = frame1.document.body.offsetHeight;
frame1.width = frame1.document.body.offsetWidth;
<body onclick="SetFullSize();">
<iframe name="frame1" id="frame1" src="http://www.mail.ru" frameborder="0">

I left only one IFRAME to shorten code here.
I tested it in the IE 6.0.
When I click (to run SetFullSize) my IFRAME(s) get correct width, but height is about half less and I see vertical scroll bars on them.

How to get correct height of the document inside of the IFRAME ?



07-11-2004, 02:08 AM

I've found my bug, after reading article I 'googled'.
Sorry for asking.