views:

290

answers:

3

I built a printable version of my data using multiple iframes to display line item details. However, if any of my iframe content is larger than a page they get cut off when printing (they display fine on the screen). All of my iframes point back to the same domain and I'm using the browser's File->Print function to do my printing. I don't think it's a browser specific bug as I get the same results in IE & FF.

What do I need to do to print an HTML document containing multiple iframes?

+2  A: 

I don't believe there's an easy way of doing this. If they're all on the same domain, why are you using IFRAMEs? Why not put the data directly in the page? If you're looking for scrolling, a div with height: ###px; overflow: auto; would allow it without having to use IFRAMEs, and a CSS print stylesheet would allow you to take the overflow/height CSS off when the user hits print.

ceejayoz
The HTML within each line item has it's own scripts and ids that aren't guaranteed to be unique across multiple line items. Trying to put them on one page will result in namespace issues and scripts showing/hiding fields that they shouldn't.
William Jens
Sounds like you've got yourself an application design problem, then.
ceejayoz
Nope, I still have a browser doesn't print what it shows on the screen problem.
William Jens
Application design is preventing you from presenting the page in a printable format.
ceejayoz
True, and I don't mean to start a flame war, but my point was that a web browser that can display content to the screen but can't correctly print it is my real problem. Either way, I think I have a work around.
William Jens
A: 

Try the following (just a guess) at the bottom of your CSS:

@media print {
    iframe {
       overflow: visible;
    }
}
Anthony
IFRAMEs don't overflow like that. They have a set height and width.
ceejayoz
A: 

I found an answer here. While less than ideal, it'll allow me to print the master record first and then optionally print each line item as a seperate print job by printing each iframe individually.

William Jens