Pdf.js: 单击printButton 或cancelButton 后如何获得反馈?

创建于 2016-08-23  ·  3评论  ·  资料来源: mozilla/pdf.js

网络浏览器:Chrome

我点击viwer.html上的 printButton ,然后触发window.print()的浏览器方法,
它打开一个预览页面。

这是问题所在:
单击此预览页面上的打印按钮或取消按钮后如何获得反馈看到打击?
因为我需要在打印成功后执行回调函数而不是取消打印。

pages

最有用的评论

感谢您的善意回复,我曾尝试侦听 afterprint 事件,但这不是我真正想要的,因为无论我在打开的窗口上单击打印按钮或取消打印按钮,当打印对话框关闭时都会触发 afterprint 事件打印对话框。

让我感到困惑的是,事件 window.print() 没有任何返回值让我知道它是打印成功还是取消或停止打印。

那么我如何才能确认我的打印任务真的成功但最终不会被取消?

在2016年8月23日,下午7:43,乔纳斯Jenwald [email protected]写道:

您应该能够监听 afterprint 事件(请参阅 https://developer.mozilla.org/en-US/docs/Web/Events/afterprint https://developer.mozilla.org/en-US/docs/Web /Events/afterprint 和 https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/ onafterprint),这是查看器在打印后用于清理的事件(在 https://github.com/mozilla/pdf.js/blob/master/web/app.js#L2312-L2314 https://github. com/mozilla/pdf.js/blob/master/web/app.js#L2312-L2314 和 https://github.com/mozilla/pdf.js/blob/master/web/app.js#L1167-L1180 https ://github.com/mozilla/pdf.js/blob/master/web/app.js#L1167-L1180)。

关闭作为回答。


您收到此消息是因为您创作了该线程。
直接回复本邮件,在 GitHub 上查看https://github.com/mozilla/pdf.js/issues/7558#issuecomment -241705562,或者将线程静音https://github.com/notifications/unsubscribe-auth/ ARE_brB9oi2RsgZZlewPzU0umg7nzfvTks5qitz9gaJpZM4Jqhtd。

所有3条评论

您应该能够监听afterprint事件(参见 https://developer.mozilla.org/en-US/docs/Web/Events/afterprint 和 https://developer.mozilla.org/en -US/docs/Web/API/WindowEventHandlers/onafterprint),这是查看器在打印后用于清理的事件(在 https://github.com/mozilla/pdf.js/blob/master/web/app.js 中)。 js#L2312-L2314 和 https://github.com/mozilla/pdf.js/blob/master/web/app.js#L1167-L1180)。

关闭作为回答。

感谢您的善意回复,我曾尝试侦听 afterprint 事件,但这不是我真正想要的,因为无论我在打开的窗口上单击打印按钮或取消打印按钮,当打印对话框关闭时都会触发 afterprint 事件打印对话框。

让我感到困惑的是,事件 window.print() 没有任何返回值让我知道它是打印成功还是取消或停止打印。

那么我如何才能确认我的打印任务真的成功但最终不会被取消?

在2016年8月23日,下午7:43,乔纳斯Jenwald [email protected]写道:

您应该能够监听 afterprint 事件(请参阅 https://developer.mozilla.org/en-US/docs/Web/Events/afterprint https://developer.mozilla.org/en-US/docs/Web /Events/afterprint 和 https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/ onafterprint),这是查看器在打印后用于清理的事件(在 https://github.com/mozilla/pdf.js/blob/master/web/app.js#L2312-L2314 https://github. com/mozilla/pdf.js/blob/master/web/app.js#L2312-L2314 和 https://github.com/mozilla/pdf.js/blob/master/web/app.js#L1167-L1180 https ://github.com/mozilla/pdf.js/blob/master/web/app.js#L1167-L1180)。

关闭作为回答。


您收到此消息是因为您创作了该线程。
直接回复本邮件,在 GitHub 上查看https://github.com/mozilla/pdf.js/issues/7558#issuecomment -241705562,或者将线程静音https://github.com/notifications/unsubscribe-auth/ ARE_brB9oi2RsgZZlewPzU0umg7nzfvTks5qitz9gaJpZM4Jqhtd。

@xingxiaoyiyio Did you find a solution?

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

patelsumit5192 picture patelsumit5192  ·  3评论

hp011235 picture hp011235  ·  4评论

PeterNerlich picture PeterNerlich  ·  3评论

liuzhen2008 picture liuzhen2008  ·  4评论

timvandermeij picture timvandermeij  ·  4评论