如何使用javascript直接在ASP.NET MVC中使用默认打印机创建pdf [英] How do I print a pdf, reciept directly on creation with default printer in ASP.NET MVC using javascript

查看:76
本文介绍了如何使用javascript直接在ASP.NET MVC中使用默认打印机创建pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要打印由Rotativa生成的收据作为pdf的部分视图,我想将生成的pdf直接打印到连接到系统的默认打印机(Say Thermal Printer)请帮我这样做,每次都会生成.pdf。



我的尝试:



我使用Window.print打印当前页面并有一个对话框。我需要将pdf页打印为连接到系统的默认打印机的收据。

解决方案

你不能。



为了打印到客户端的打印机,浏览器将始终显示一个对话框。没有办法解决这个问题。



(想象一下,如果您访问过的每个随机网站都能在未经确认的情况下将内容打印到默认打印机,打印机墨盒销售商会有多高兴!)

I need to print a Receipt which is generated by Rotativa as partialview as pdf, I would like to print the reciept generated as pdf directly to the default printer connected to the system ( Say Thermal Printer) Kindly help me to do it, the .pdf will be generated each time.

What I have tried:

I used Window.print it prints the current page and has a dialogue box. I need the pdf page to get printed as a receipt in the default printer connected to the system.

解决方案

You can't.

In order to print to the client's printer, the browser will always display a dialog box. There is no way around that.

(Imagine how happy the printer ink cartridge sellers would be if every random website you visited was able to print things to your default printer without confirmation!)


这篇关于如何使用javascript直接在ASP.NET MVC中使用默认打印机创建pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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