How to export data to pdf in asp.net MVC?

I don't have a gridview as I am working on asp.net MVC.

So, I can create a Response object that writes data to pdf format

Response.AddHeader("Content-Disposition", "attachment; filename=data.pdf");
Response.ContentType = "application/.pdf";

      

I am using these two lines, but I don’t know what format should I write the data in?

+1


a source to share


2 answers


you have to use a PDF library like iTextSharp . just do a google search. I usually generate my PDF reports on the fly using viewer control report (client side mode).



+1


a source


Lol.



You need to get a PDF converter to convert from whatever format you use to PDF. Last I checked there weren't fully functional converters for free. Buy it, buddy.

0


a source







All Articles