且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

打印字符串变量的内容对本地打印机ASP.NET

更新时间:2023-12-04 11:39:10

不会有客户端的打印机上直接访问。相反,你可以有一个链接/按钮,一个打印此页,或者只有你所需要的信息(即列表中的内容)的页面。然后,客户机可以打印页面选择自己的本地打印机。

Because of how web browsers are designed the server (your code) will not have direct access to the client's printer. Instead, you can have a link/button to a 'print page' or a page that only has the information you need (the contents of that list). The client can then print that page selecting their own local printer.

您可以包括在主体后打印页一些JavaScript,将提示用户进行打印。

You could include some javascript in the print page after the main body that will prompt the user to print.

window.print()如果你想要做什么。