打开新的标签铬打印的目的

Open in new tab chrome for printing purpose

本文关键字:打印 标签      更新时间:2023-09-26

我想在新选项卡中打开打印屏幕选项,而不是在新窗口中打开。

这是我的javascript代码

$scope.PrintWindow = function(divName,method) {
  var printContents = document.getElementById(divName).innerHTML;
  var popupWin = window.open('Print', method, 'fullscreen=yes');
  popupWin.document.open()
  popupWin.document.write('<html><head><link href="print.css" rel="stylesheet" type="text/css" media="print"></head><body onload="window.print()">' + printContents + '</html>');
  popupWin.document.close();
           popupWin.focus();
} 

_self在同一窗口打开

_target and _newtab在新窗中打开。我想把它设为new tab

删除全屏=yes,它解决了我的问题。

  $scope.PrintWindow = function(divName,method) {
      var printContents = document.getElementById(divName).innerHTML;
      var popupWin = window.open('Print', method,);
      popupWin.document.open()
      popupWin.document.write('<html><head><link href="print.css" rel="stylesheet" type="text/css" media="print"></head><body onload="window.print()">' + printContents + '</html>');
      popupWin.document.close();
               popupWin.focus();
    }