[英]how to remove margin or padding of window in javascript/css?
我正在尝试使用javascript
打印图像:
function printImage(src){
var printWindow = window.open('', 'Print Window','height=400,width=600');
printWindow.document.write('<html><head><title>Print Window</title>');
printWindow.document.write('</head><body ><img src=\'');
printWindow.document.write(src);
printWindow.document.write('\' /></body></html>');
printWindow.document.close();
printWindow.print();
}
printImage(src); //this is image src..
它打印得很好,问题在这里:
我要删除该空白区域,因为我将其打印在窄纸上(比尔/收据纸)。 由于存在空白,图像打印很小。 我尝试过像set style="margin-top:-25px; margin-left: -25px;"
在img
但是它的打印像:
如何在left top
打印image
而没有任何空白空间?
帮帮我..谢谢
您可以尝试CSS @page
@page {
size: auto;
margin: 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.