在ASP.NET MVC 4中提供打印功能 [英] Provide Print functionality in ASP.NET MVC 4
本文介绍了在ASP.NET MVC 4中提供打印功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有HTML表的视图,其中填充了我想在ASP.NET MVC 4和C#中打印的信息.
I have a view with HTML tables, filled with information that I want to print in ASP.NET MVC 4 and C#.
我不知道打印文档的实际代码,将不胜感激
I don't know the actual code that prints the document, any help will be appreciated
推荐答案
那么您有两种选择
-
要么使用JS
Either use JS
<a href="javascript:window.print()">Click to Print This Page</a>
对于JS选项,您需要构建一个打印CSS 文件,以便在打印过程中最好地呈现页面,同时还隐藏了一些不需要显示的元素-例如菜单.
For the JS option you will want to build a print css file so as to best render the page during printing, also hide some element that you don't need to appear - menus for example.
这篇关于在ASP.NET MVC 4中提供打印功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文