如何从javascript(web应用程序)打印到收据打印机?

如何从javascript(web应用程序)打印到收据打印机?,javascript,asp.net,posprinter,Javascript,Asp.net,Posprinter,我尝试从javascript打印,如下所示 function PrintElem() { var mywindow = window.open('', 'PRINT'); mywindow.document.write('<html><head><title>Payment Slip</title>'); mywindow.document.write('</head><body style="text-a

我尝试从javascript打印,如下所示

function PrintElem() {
    var mywindow = window.open('', 'PRINT');
    mywindow.document.write('<html><head><title>Payment Slip</title>');
    mywindow.document.write('</head><body style="text-align:center;font: Georgia, "Times New Roman", Times, serif;background: #fff;font-size: 22pt;margin:20px auto auto 50px;" >');
    mywindow.document.write('<header style="text-align:center; white-space:nowrap;overflow:hidden;line-height: 1em;">' +
    '<p  style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 12pt;">Payment Slip</p>' +
    '<p style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 1em;">' + $('.mylabelpaymentheader').html() + '</p>' +
'</header>');
    mywindow.document.write('<content style="text-align:center;">' +
    '<table style="margin-left: auto;margin-right: auto;border-collapse: collapse;font-size:16pt;">' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Name:</td><td  style="border:1px solid black">' + $('.lblName').html() + '</td></tr>' +
        '<tr style="border:1px solid black"><td style="border:1px solid black">Address:</td><td style="border:1px solid black">' + $('.lblAddress').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Meter No:</td><td  style="border:1px solid black">' + $('.lblMeterNo').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Token:</td><td  style="border:1px solid black">' + $('.lblToken').html() + '</td></tr>' +
    '</table>'+

'</content>' +
'<footer>' +
'<hr style="margin-top:30pt;margin-bottom:30pt;">' +
    '<p style="text-align:right;">&copy pdb</p>' +
'</footer>'+
'');
    mywindow.document.write('</body></html>');
    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/
    mywindow.print();
    mywindow.close();
    return true;
}
函数PrintElem(){ var mywindow=window.open(“”,'PRINT'); mywindow.document.write(“付款单”); mywindow.document.write(“”); mywindow.document.write(“”)+ “

”+$(“.mylabelpaymentheader”).html()+”

'+ ''); mywindow.document.write(“”)+ '' + '名称:'+$('.lblName').html()+''+ '地址:'+$('.lblAddress').html()+''+ '仪表编号:'+$('.lblMeterNo').html()+''+ '标记:'+$('.lblToken').html()+''+ ''+ '' + '' + “
”+ “

”+ ''+ ''); mywindow.document.write(“”); mywindow.document.close();//对于IE>=10是必需的 mywindow.focus();//IE>=10所必需的*/ mywindow.print(); mywindow.close(); 返回true; }


当print out.font太小时。如果我增加字体大小,它不会反映在POS打印机上。我使用RP58 58mm热敏收据打印机。我必须遵循另一种方法吗?或者如何正确操作?

这是驱动程序的问题。我用合适的58mm选项重新设置了驱动程序,一切都像一个符咒一样工作。

我需要知道这个问题的答案,我想知道你们是否设法弄明白了?你们都看过这个项目吗: