简体   繁体   English

在Asp.net MVC4中静默打印PDF文件

[英]Print PDF file silently in Asp.net MVC4

I want to print PDF file silently without any print preview. 我想静默打印PDF文件而不进行任何打印预览。 Currently I used return File(stream, fileName, "application/pdf") from an MVC action for print but it will download file. 目前我使用来自MVC动作的return File(stream, fileName, "application/pdf")进行打印,但它将下载文件。

It is possible to send PDF file direct to printer without print preview ? 可以直接将PDF文件发送到打印机而无需打印预览?

you can't unless If you know the users who needs silent print or your app is internal in company then you can create custom protocol to communicate with users pc. 你不能,除非你知道需要静音打印的用户或你的应用程序是公司内部的,那么你可以创建自定义协议与用户pc通信。

protocol runs an app which sends file to the default printer. 协议运行一个应用程序,将文件发送到默认打印机。 once users select check box not to see warning again. 一旦用户选中复选框,不再看警告。 they will be able to send files to their default printer directly. 他们将能够直接将文件发送到默认打印机。 Just like skype. 就像Skype一样。 if you type skype:212312 on your browser then skype application will run and call given number. 如果您在浏览器上键入skype:212312,则skype应用程序将运行并调用给定的号码。

the app that is called by protocol is up to you. 协议调用的应用程序取决于您。 You can either create a custom app or you use 3rd party applications. 您可以创建自定义应用程序,也可以使用第三方应用程序。

你可以看到下面的对话框

No. Across the web, downloads and system operations will always require user interactions to confirm things. 在网络上,下载和系统操作总是需要用户交互来确认。

A solution might be to create a desktop application or service that communicates with your web application, this app/service would then download and print outside the context of the web application and you will have much more control. 解决方案可能是创建与您的Web应用程序通信的桌面应用程序或服务,然后此应用程序/服务将在Web应用程序的上下文之外下载和打印,您将拥有更多的控制权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM