IFrames Printing Issues

[ Simplified version of this question: ]

Why does iFrames sometimes refuse to print? For example, click print previewon these two pages:

When printing a preview, iFrames are visible in the first example, but hidden in the second. Code Difference ONLY between first and second iFrames - this CSS ( margin: 20px;) property was added to iFrames in the second example.


[ Long (original) version: ]

I am creating a preview / print page that collects a bunch of independent HTML files that reference their own styles and javascript files.

The idea is that all files are displayed in iFrames for preview, and then when printed, each iFrame (which is likely to span multiple pages) prints as if it were its own document.

However, when I print (or print-preview), iFrames either does not show content or prints only the first page, trimming the remaining iFrame pages.

iFrames printed (and printed) just fine before I made them a few pages:

What is the reason for this behavior?

+5
source share
1 answer

, print() ....

, - 2:

$('#iframeTwo')[0].contentWindow.print()

jsfiddle, , ...

http://jsfiddle.net/sg3s/GJKkm/17/

, iframe . , - , , ... ( window.open() js), , , iframe .

+3

All Articles