我想在div內容完成打印時停止打印。問題是,如果內容中的內容很少,則會將該頁面的其餘部分顯示爲空白。我希望在內容後切出頁面已完成打印。我正在使用收據打印機。在完成打印div內容後停止打印
function Popup(data)
{
var mywindow = window.open('', 'day', 'height=300,width=400');
mywindow.height
mywindow.document.write('<html><head><title>my div</title>');
mywindow.document.write('<link rel="stylesheet" href="style.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.print();
return true;
}
下面是解決收據打印機的一個問題 - http://stackoverflow.com/questions/5232531/receipt-printer-print-from-webpage – TimSPQR