Vikas
Vikas

Reputation: 24322

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

I don't have grid view as I am working on asp.net MVC.

So can I create Response object which writes data into pdf format

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

I use these two lines but I don't know in which format, I should write data?

Upvotes: 1

Views: 5072

Answers (2)

Andrea Balducci
Andrea Balducci

Reputation: 2852

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

Upvotes: 2

User
User

Reputation: 30945

LOL.

You need to get PDF converter to convert from whichever format you use to PDF. The last I checked there were no fully functional converters for free. Buy it, buddy.

Upvotes: 0

Related Questions