直接打印,无窗口提示,份数,PHP Javascript / Jquery

我在php上有一个内联网网站系统。 打印票证时,我不希望收到myWindow.print(); 提示窗口,并希望指定它的副本数量,以php和javascripst / jquery代码打印。</ p>

我目前的示例代码是这样的</ p>

 <  code> function PrintTicket()
{
myWindow = window.open('','','width = 200,height = 100');
myWindow.document.write(“&lt; p&gt; Ticket No: '12345'&lt; / p&gt;“);
myWindow.document.close();

myWindow.focus();
myWindow.print();

}
</ code> </ pre>

请告知我该怎么办,因为打印机EPSON不会将副本数作为参数。 </ p>
</ div>

展开原文

原文

I have an intranet website system on php. When Print Tickets, I do not wish to receive the myWindow.print(); prompt window and wish to assigned it number of copies to print in php and javascripst/jquery code.

My current sample code is as such

function PrintTicket()
{
    myWindow=window.open('','','width=200,height=100');
    myWindow.document.write("<p>Ticket No: '12345'</p>");
    myWindow.document.close();  
    myWindow.focus();
    myWindow.print(); 
}

Please advise how can I do so as printer EPSON do not take number of copies as parameter.

1个回答



这是不可能的,因为唯一暴露的浏览器的JavaScript API是需要用户交互的打印JavaScript。
它也是一个安全问题,想象一下 一个在没有用户批准的情况下打印数百页的网页。
此外,JavaScript无法查看连接到计算机的打印机或同一安全属性的其他设备枚举。</ p>
</ div>

展开原文

原文

This is not possible because the only browser's JavaScript API exposed is the print one which requires user interaction. It's also a security matter, imagine a web page that prints hundreds of pages without user approval. Also, JavaScript can't view printers connected to computer or other devices enumeration for the same security purpouse.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐