如何直接在asp.net mvc中打印 [英] How to print directly in asp.net mvc

查看:74
本文介绍了如何直接在asp.net mvc中打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用asp.net MVC技术开发应用程序它的库存应用程序我已经做了一些打印选项,包括条形码但我不能直接打印我使用window.print。当激活此功能时,chrome将显示另一个用于打印的弹出窗口(默认Web打印弹出窗口)。然后再次我想点击打印然后只有我可以打印。我们的客户还没准备好做那样的事情。还有其他任何方式可以直接打印或者我可以使用java脚本



我尝试了什么:



我试过JavaScript

Window.print()

Hi,

I'm developing application with asp.net MVC Technology its a inventory application i have done some printing options including barcode but i cant print directly im using window.print. when fire this function chrome will show another popup(default web printing popup) for print. then again i want to click print then only i can print. Our client not ready to do something like that.is any other way to print directly or can i go with java script

What I have tried:

I tried JavaScript
Window.print()

推荐答案

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



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



所以,请向客户解释一下。这不在您手中。如果你想直接与打印机对话,那么你需要做桌面应用而不是网络应用。
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.


这篇关于如何直接在asp.net mvc中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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