PDA

View Full Version : Printing a page in a frame problem



tpeck
Jun 21st, 2007, 09:05 AM
I'm having great problems trying to print out pages from within the middle frame of three horizontal frames in Internet Explorer (only):



<frameset framespacing="1" rows="45,*,35">
<frame name="topFrame" scrolling="no" noresize target="middle" marginwidth="0" marginheight="0" src="topframe.html">
<frame name="middle" marginwidth="8" marginheight="16" target="_parent" scrolling="yes" src="page.html">
<frame name="bottom" target="middle" marginwidth="0" marginheight="0" scrolling="no" noresize src="botframe.html">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>


The problem is that the pages spill over to another page (in all printers I've tested - and in a pdf) BUT (and this is weird) if I print the page OUTSIDE of the frames, they print out on one single page as designed.

The javascript used to print the page is simple enough:



function printit(){
window.parent.middle.focus();
window.print();
}


...but i don't think the function is the problem.

Does anyone know why a page would print out differently (i.e. longer) if inside a frame in a frameset, why this should be so, and what I can do to prevent the difference and have it print like a normal page?

Thanks.

_Aerospace_Eng_
Jun 21st, 2007, 10:49 AM
Because IE doesn't handle the stylesheet the same way when it prints. For this you need to create a print stylesheet. There are many resources out there. You just need to search.

tpeck
Jun 22nd, 2007, 04:02 AM
Thanks. I think it's actually worse than I thought because it is a problem involving IE7's "shrink to fit" - so I have discovered. Apparently, the feature is enabled by default, but when printing the contents of a frame, "shrink to fit" does not occur - at least, not automatically. Therefore, it's hard to know what's going on and when.

It's a poor show when "shrink to fit" is the default. It leads you to believe something is the way it is, when it is not. At the very least, the feature - before being applied - should be offered as an option. Grrr...

I found some attempts at fixes here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=983052&SiteID=1

...but it really means making sure the page is first created using 100% in Print Preview with shrink to fit off, so that the length is right in thefirst place and won't spill over (if no spill is what you are hoping for).