ASP.NET-如何使用打印机从客户端打印文本 [英] ASP.NET-How to Print a text from client side using a printer

查看:440
本文介绍了ASP.NET-如何使用打印机从客户端打印文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.NET制作销售点网站的Web部件(visual studio 2012)。



如何从网站打印文本文件到客户端的打印机,



打印机将是连接到客户端计算机的本地打印机。

解决方案

您必须使用客户端编程来打印网页文档。如果您想使用JavaScript,那么这对您有用,



  / /  显示打印对话框 
window .print();





网页表单中的文档已存在于客户端系统中。一旦执行此代码,它将向他显示一个打印对话框,然后他可以使用它来打印文档。你不能强迫机器打印,他仍然必须按下他的系统上的打印按钮,这只是方便他看到打印文件的对话框。



窗口的MDN资源.print() [ ^ ]。


I am making a Web Part for a Point of sale site with .NET (visual studio 2012).

How can I print a text file from the site to a printer on the client side,

The printer will be a local printer attached to the client machine.

解决方案

You would have to use the client-side programming to print a web page document. If you want to use the JavaScript, then this would work for you,

// show the print dialog box
window.print();



The document in a web page form is already present on the client's system. Once this code would execute, it will display a print dialog to him, which he can then use to print the documents. You cannot force the machine to print, he will still have to press the "Print" button on his system, this would just facilitate him to see the dialog for printing the document.

MDN resources for window.print()[^].


这篇关于ASP.NET-如何使用打印机从客户端打印文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆