Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Internet Explorer中打印时获取文档大小_Javascript_Css_Internet Explorer - Fatal编程技术网

Javascript 在Internet Explorer中打印时获取文档大小

Javascript 在Internet Explorer中打印时获取文档大小,javascript,css,internet-explorer,Javascript,Css,Internet Explorer,我试图在打印页面时更改谷歌图表的大小 要在执行打印时获取回调,我正在使用: if ("matchMedia" in window) { window.matchMedia("print").addListener(((media) => { if (media.matches) { this.beforePrintHandler(); } else { $(document).one('mouseover', this.afterPrintHan

我试图在打印页面时更改谷歌图表的大小

要在执行打印时获取回调,我正在使用:

if ("matchMedia" in window) {
  window.matchMedia("print").addListener(((media) => {
    if (media.matches) {
      this.beforePrintHandler();
    } else {
      $(document).one('mouseover', this.afterPrintHandler);
    }
  }).bind(this));
}

$(window).on("beforeprint", this.beforePrintHandler);
$(window).on("afterprint", this.afterPrintHandler);
问题在于,使用onbeforeprint事件时,文档大小等于网页大小,而不是要打印的页面大小

使用matchMedia时,文档大小等于打印页面大小

不幸的是,IE和Firefox不会在“打印”媒体更改时触发

感谢您的帮助