火狐插件打印(JS Print Setup)

时间:2021-12-10 16:25:20
  <script type="text/javascript">
$(document).ready(
function(){
// loadding();
});
function closewin(){
self.opener
=null;
self.close();
}
function clock(){
i
=i-1
if(i>0){
setTimeout(
"clock();",2000);
}
else{
this.window.opener = null;
window.close();
}
}
function loadding() {
jsPrintSetup.setOption(
'orientation', jsPrintSetup.kPortraitOrientation);
jsPrintSetup.setOption(
'marginTop', 0);
jsPrintSetup.setOption(
'marginBottom', 0);
jsPrintSetup.setOption(
'marginLeft', 0);
jsPrintSetup.setOption(
'marginRight', 0);
// set page header
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption(
'headerStrCenter', '');
jsPrintSetup.setOption(
'headerStrRight', '');
// set empty page footer
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption(
'footerStrCenter', '');
jsPrintSetup.setOption(
'footerStrRight', '');
// Suppress print dialog
jsPrintSetup.setSilentPrint(true);
// Do Print
jsPrintSetup.print();
// Restore print dialog
//
jsPrintSetup.setSilentPrint(false);
//
close();
blackPrint();
closewin();

}
function blackPrint(){
if(window.opener){
console.log(
1);
console.log(window.opener);
var id=${empId};
if(id != null && id != "" && id != undefined){
window.opener.callback(id);
}
}

}
</script>

<body onload="loadding()">
<div style="width: 100%;height: 100%;" >
<img src="<%=basePath%>${barcodeUrl}" style="padding-top: 20px;"/>
<p style="font-size: 24px;">${empName}_${companyName}</p>
</div>
</body>

火狐插件打印,浏览器要安装JS Print Setup(火狐57版本不支持此插件)

火狐插件打印(JS Print Setup)