且构网

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

如何直接在asp.net mvc中打印

更新时间:2023-12-02 08:07:28

你无法绕过这个。由于安全原因,浏览器不允许您直接与设备或文件系统通信。



想想一个场景,你将打开一个网站,它将发送在您不知情的情况下直接将命令打印到打印机它可以打印任何想要的东西,对吗?这应该受到限制。因此,浏览器将获得用户的许可与设备通信,这是一种很好的方法。



所以,请向客户解释一下。这不在您手中。如果你想直接与打印机对话,那么你需要做桌面应用而不是网络应用。
You can't bypass this. Browsers won't allow you to directly talk to devices or file system due to security reasons.

Think of a scenario, where you will open a website, which will send print commands directly to your printer without your knowledge. It can print whatever it wants, right? That should be restricted. So, browsers will take user's permission to talk to the device and that is a good approach.

So, explain this to the client. This is not in your hand. If you want to directly talk to printer, then you need to do desktop apps rather than web apps.