如何直接打印到客户端的打印机? [英] How to print to client's printer directly?

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

问题描述

始终打印到服务器的打印机



我尝试过:



Dim doc As New ReportDocument

doc.Load(.. \ CrystalCoreReport4.rpt)

doc.PrintToPrinter(1,True,0,0)

always print to server's printer

What I have tried:

Dim doc As New ReportDocument
doc.Load("..\CrystalReport4.rpt")
doc.PrintToPrinter(1, True, 0, 0)

推荐答案

代码在服务器上运行,因此访问服务器的打印机。



出于安全原因,在服务器上运行的此类代码对客户端硬件没有访问权限或访问权限非常有限。但是有一些解决方案可以在客户端上打印Crytal报告:

Crystal Reports客户端打印查看器 [ ^ ]

直接在ASP.NET中打印Crystal报表C# - Stack Overflow [ ^ ]
The code is running at the server and accesses therefore the printer of the server.

For security reasons such code running on the server has no or very restricted access to the client's hardware. But there are solutions to print Crytal Reports on the client:
Crystal Reports Client Side Printing without the Viewer[^]
Print Crystal Report Directly in ASP.NET C# - Stack Overflow[^]


它打印到服务器的打印机,因为您的代码在服务器上运行,它无法访问客户端的硬件。您无法通过Web代码打印到用户的打印机。如果你可以,那么网站也会经常向你的打印机发送垃圾广告。
It prints to the server's printer because your code is running on the server, it has no access to the client's hardware. You can't print to the user's printer from your web code. If you could then websites would be constantly sending spam adverts to your printer too.


引用:

总是打印到服务器的打印机

always print to server's printer



这是因为VB代码总是在服务器上运行,而不是客户端 - 因此它可以访问的打印机都连接到服务器。它看起来像是在开发中工作,因为服务器和客户端是相同的物理机器。



服务器没有任何直接访问客户端硬件 - 包括任何打印机 - 出于安全考虑。想象一下,如果他们可以直接访问打印机,恶意网站会对您的打印机做些什么?


That's because VB code always runs on the Server, not the Client - so the printers it has access to are all connected to the server. It looks like it works in development because the server and the client are the same physical machine.

The server does not have any direct access to the client hardware - including any printers - for security reasons. Imagine you could: what would malicious sites do with your printer if they could access it directly?


这篇关于如何直接打印到客户端的打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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