[英]IE9 altering content of <img> when printed
I am trying to print a webpage which is supposed to contain some images (icons). 我正在尝试打印一个应该包含一些图像(图标)的网页。 They are displayed alright in the page, and Firefox prints them fine, but IE ruins most of them. 它们在页面上正确显示,并且Firefox可以很好地打印它们,但是IE破坏了它们中的大多数。
What is doing this, and how can I fix it? 这是怎么做的,我该如何解决?
These icons are being set in a loop in JSP: 这些图标在JSP中循环设置:
<t:dataTable newspaperColumns="1"
value="#{page.afterSales.leftOptionColumn}" var="row">
<h:column>
<h:graphicImage value="#{row.imgIsCompleted}" style="width: 16px !important;"/>
<h:commandButton value="#{row.rowName}"></h:commandButton>
</h:column>
</t:dataTable>
The reason for that problem is unknown to me, i can say it is because of heavey CSS altought.. but as a work around i recommand you extract target DOM element
with js, and create a new window where you have the content free from CSS styles which can genereate such a problem with <img>
tags. 这个问题的原因对我来说是未知的,我可以说这是因为CSS太笨了。但是作为一种变通办法,我建议您使用js提取target DOM element
,并创建一个新窗口,其中的内容不包含CSS可以使用<img>
标签产生此类问题的样式。
My work around: 我的工作:
function printCssCleanContent(){
var prtContent = Ext.query('span[id*=overView]')[0]; // just the root dom node i choise to print (can be done with vanilla js or jquery or any other dom parser)
var WinPrint = window.open('', '', 'left=0,top=0,width=1200,height=900,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.