I have the following code to print the content of a popup window:
var frame = this._urlElement;
if (frame) {
var content = frame.contentWindow.document.getElementById("content");
if (content) {
MarvalSoftware.UI.Dom.setStyles(content, { 'overflow': 'visible' });
}
frame.contentWindow.focus();
frame.contentWindow.print();
}
where _urlElement
is an iframe, and its content doc has overflow: auto
. When I print to PDF in IE11, I only see the first page, and the content is not cleanly cut off, nor are any scrollbars visible on the printed PDF. If I try Print Preview, even inside the iframe, I see the whole page with the outline of the popup window.
The page I am trying to print from the Iframe has a master page, with a content
div with overflow: auto
. When I print like that, Chrome and IE, I see a scrollbar on the print-out, and the print-out is only one page, so in my page's stylesheet, I override that overflow rule with a media query for print, to overflow: visible
. Then, when I print on Chrome, the scrollbar is gone, and the printout is two pages. In IE, the scrollbar is also gone, but the print-out is unceremoniously cut off at the end of printed page 1.
When I modify my print code to create a new IFrame, and insert it into the document to be printed, copy the stylesheets and body over to the new iframe, and print the new iframe, then even on IE, the full document is printed. That is, the new iframe is not contained in any elements of the master page, so, is there any other styling in the master page I can look for that could cause this, other than overflow
?
BTW, I seem to only experience this behaviour when I print to PDF, using Windows's own 'PDF printer'.