python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
razorpdf iTextSharp in mvc 5

Razorpdf iTextSharp in MVC 5

In the firest step need to add razorpdf library the details as given below.

  1. Go to Visual studio tool
  2. Go to library package manager
  3. Go to manage nuget packages
  4. Go to search razorpdf dll online and install.

In the 2nd step, code sample for cshtml

@model IEnumerable<Model.proc_GetProductServicePDF_Result>

<table border="1" width='500' bordercolor="Green">    
      @foreach (var item in Model)
        {           
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.LineOfBusiness)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ProductClassification)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Product)
                </td>
          </tr>           
        }       
</table>


In the 3rd step, code sample for controller

public ActionResult PDF()
{
    List<Model.proc_GetProductServicePDF_Result> objPDF = new ProductServiceRepository().GetProductServicePDFDetail(_userSession.CompanyID, _userSession.TenantID); 

 return new RazorPDF.PdfResult(objPDF, "PDF");
}


ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions