(这是通过Grease/Tampermonkey)
此处为使用 Chrome beta 浏览器的 skiosk 打印函数 :
$("#autoCheckOrder button").click ( function () {
var newWin = window.open ("");
newWin.document.write ( "<!DOCTYPE html>" );
newWin.document.write( "<html>" );
newWin.document.write( "<head>" );
newWin.document.write( "<title>" );
newWin.document.write( "</title>" );
newWin.document.write( "<style>" );
newWin.document.write( "@media print { " );
newWin.document.write( "body { " );
newWin.document.write( "background-color: white;" );
newWin.document.write( "width: 55mm;" );
newWin.document.write( "position: absolute;" );
newWin.document.write( "top: 0;" );
newWin.document.write( "left: 0;" );
newWin.document.write( "padding: 0px;" );
newWin.document.write( "font-size: 14px;" );
newWin.document.write( "line-height: 18px;" );
newWin.document.write( "}" );
newWin.document.write( "}" );
newWin.document.write( "</style>" );
newWin.document.write( "</head>" );
newWin.document.write( "<body>" );
newWin.document.write ( loanHTML );
newWin.document.write( "</body>" );
newWin.document.write( "</html>" );
if(newWin.print()) {
newWin.close();
} else {
newWin.close();
}
});
It grabs a table from the a page listing all items, then creates a receipt . The receipt is then printed. This worked perfectly for a while, now it only prints the first item.
我尝试过以下方法,但完全没有结果:
- Using page-break-after: always
- Placing receipt in div with the above CSS rule
- Reinstalling the printer
- Paper reduction settings for printer
疯狂的是,它曾经完美地打印所有项目,现在却没有。我甚至从备份中重新安装了脚本,只是为了确定。
不知道从这里往何处去。 所有内容都在打印预览中显示, 但只有第一个项目指纹。 页眉和页脚设置只会让事情变得更糟糕, 而不是更好 。
<强> UPDATE 强>
我更改了发往打印机的 HTML, 并且它有效 。 仍然不确定它是否完全有效, 但它正在打印 。 如果它停止打印, 我会知道要修什么。 感谢您的输入!