如何使用C#在ASP.NET Web应用程序中打开打印对话框? [英] How to open print dialog box in ASP.NET web application using C#?

查看:169
本文介绍了如何使用C#在ASP.NET Web应用程序中打开打印对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#打开asp.net web应用程序中的打印对话框?



我尝试过:



如何使用c#打开asp.net web应用程序中的打印对话框?

how to open print dialog box in asp.net web application using c#?

What I have tried:

how to open print dialog box in asp.net web application using c#?

推荐答案

你不能 - C#代码在服务器上运行,而不是在客户端上运行,并且您无法直接访问任何客户端硬件。

如果打开打印对话框,它将在服务器上显示,而不是客户端并将打印到服务器连接的打印机。
You can't - the C# code runs on the server, not the client, and you don't have direct access to any client hardware.
If you open a print dialog, it will be visible on the server, not the client and will print to server connected printers.


如果您想让网络用户打印当前显示的页面,请尝试类似

If you are wanting to enable the web user to print the currently displayed page, try something like
<input type="button" onclick="window.print();" />





如果您想要自定义输出,请在新页面中创建(例如,使用



If you want a custom output, create it in a new page (e.g. using

window.open()

)然后在其中包含一个window.print()。



但请注意,您只能获得打印选项对话框,而不是选择文件名对话框。



此外,请注意打印设施可能被组禁用政策或用户偏好;在这种情况下,告诉他们使用浏览器菜单选项。

) and then include a window.print() in it.

However, please note that you will only get the print options dialog, not the 'select filename' dialog.

Also, note that the print facility may be disabled by group policy or by user preference; in which case, tell them to use the browser menu options.


这篇关于如何使用C#在ASP.NET Web应用程序中打开打印对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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