带有图像的窗口 - Chrome中的打印()问题 [英] Window with Image - Print() Issue in Chrome
本文介绍了带有图像的窗口 - Chrome中的打印()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打开一个新窗口并使用.print()函数来打印文档。
文档也有图像。但在铬版中,它打印时没有图像。
在打印[setTimeout]之前添加了一些延迟来加载图像,但没有帮助。 b
函数PrintContent(){
var DocumentContainer = document.getElementById (rClientID);
var WindowObject = window.open('',PrintOrder,
width = 740,height = 325,top = 200,left = 250,toolbars = no,scrollbars = yes,status = no ,可调整大小=无);
WindowObject.document.open();
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
//WindowObject.close();
返回false;
}
解决方案
onload-event上的窗口对象,
只能在加载页面后调用。
似乎正在工作很好。
WindowObject.onload = function(){WindowObject.print()};
I am printing a document by opening a new window and using .print() function.
Document has images also. But in chrome, it prints without images.
Added some delay to finish loading images before printing [setTimeout], but didn't helped. its printing half of the image.
function PrintContent() {
var DocumentContainer = document.getElementById(rClientID);
var WindowObject = window.open('', "PrintOrder",
"width=740,height=325,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
WindowObject.document.open();
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
//WindowObject.close();
return false;
}
解决方案
Modified the printing line, printing window object on onload-event,
supposed to call only after loading the page.
seems to be working fine.
WindowObject.onload = function() { WindowObject.print() };
这篇关于带有图像的窗口 - Chrome中的打印()问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文