Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provide Print functionality in ASP.NET MVC 4

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

like image 676
RobertKing Avatar asked Jul 09 '13 09:07

RobertKing


1 Answers

Well you have two choices

  1. Either use JS

    <a href="javascript:window.print()">Click to Print This Page</a>

  2. Or print to a PDF using Action Result in MVC

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.

like image 151
Ryan McDonough Avatar answered Oct 10 '22 00:10

Ryan McDonough