从Chrome中打印铬:如何知道打印完成? [英] Printing from javascript in chrome: how to know printing is done?
问题描述
在我的chrome浏览器版本17.0.942.0 winvista中, printdlg不是通常的模式系统printdlg,而是在网站内呈现。所以我想按照这里的描述打印画布内容。但代码
window.print();
window.close();
不会工作,因为 window.close
也关闭printdlg。所以在chrome window.close
中必须由用户启动或以某种方式延迟。有没有办法知道 window.print
是否已经完成,这样窗口可以自动关闭?
在类似于您所遇到的错误报告中查看此评论:
http://code.google.com/p/chromium/issues/detail?id=92107#c31
看起来像 window.print
是异步的,解决方法是在打印后检查鼠标移动事件,当打印对话框出现时关闭,那么您可以执行其余的操作。
In my chrome browser version 17.0.942.0 winvista the printdlg is not the usual modal system-printdlg but renderered within the website itself. So I want to print canvas content as described here. But the code
window.print();
window.close();
wont work, because window.close
also closes the printdlg. So in chrome window.close
must be initiated by the user or delayed somehow. Is there a way to know if window.print
was finished, so that the window can be closed automatically?
Check this comment on a bug report similar to what you are experiencing: http://code.google.com/p/chromium/issues/detail?id=92107#c31
It seems like window.print
is async, the workaround is to check for a mouse movement event after the print, which would occur when the print dialog is closed, then you can perform the rest of your actions.
Also see: Chrome window.print() window.close() results in 'print preview failed'. Solution?
这篇关于从Chrome中打印铬:如何知道打印完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!