繁体   English   中英

检查页面打印是否已打印,然后将其关闭

[英]check if the page print has been printed and then close it

我想检查该页面是否已打印,然后将其关闭。 我搜索了很多,但没有我试过的答案:

1- window.matchMedia('print')  but it return always false.
2-window.onafterprint it doesn't work anymore.

3- 我无法创建新文档并在其中插入我的页面正文,因为我的页面来自 Crystelreport 并且它确实有条形码。

我的代码很简单:

var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function () {
                                    win.close();
}

尝试这个:

var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function (e) {
    e.target.close();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM