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)
                    @Html.DisplayFor(modelItem => item.LineOfBusiness)
                    @Html.DisplayFor(modelItem => item.ProductClassification)
                    @Html.DisplayFor(modelItem => item.Product)

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 is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.