var body = window.document.body.innerHTML;
var printArea = window.document.getElementById("content").innerHTML;
window.document.body.innerHTML = printArea;
if (document.all.eprint.defaultPrinterName.length==0){
alert("请先安装打印机,再执行此功能!");
return;
} document.all.eprint.InitPrint();
document.all.eprint.SetMarginMeasure(1);//1mm是default, 2 inch
document.all.eprint.paperSize = "输液单111";//设置值与打印机的自定义纸的名称相同
document.all.eprint.pageWidth = 200;
document.all.eprint.pageHeight = 200;
alert("已设置纸的宽为200mm,高为200mm!");
// document.all.eprint.Preview();
window.print();
window.document.body.innerHTML = body;
return false;
报错:document.all.eprint.defaultPrinterName为空或不是对象
var printArea = window.document.getElementById("content").innerHTML;
window.document.body.innerHTML = printArea;
if (document.all.eprint.defaultPrinterName.length==0){
alert("请先安装打印机,再执行此功能!");
return;
} document.all.eprint.InitPrint();
document.all.eprint.SetMarginMeasure(1);//1mm是default, 2 inch
document.all.eprint.paperSize = "输液单111";//设置值与打印机的自定义纸的名称相同
document.all.eprint.pageWidth = 200;
document.all.eprint.pageHeight = 200;
alert("已设置纸的宽为200mm,高为200mm!");
// document.all.eprint.Preview();
window.print();
window.document.body.innerHTML = body;
return false;
报错:document.all.eprint.defaultPrinterName为空或不是对象
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货