Monday, March 28, 2011

Export Gridview to PDF

we have seen how to export the data from gridview to Excel file, today this post will helps you to export the gridview data to PDF, if you want protect you data being edit/ cut/ delete then Export to PDF will be a better option for you.there is a open source project for iTextShart. you can download the dll from them and you can use it.

only you need to add this content on your page

Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename= SampleExport.pdf");
Response.End();


Even you can format the text also,if you want to set the page with A4 or any other even you can also do the same.you can also specify the font size, style color all the basic things you can do with it.

you can download the code from the below link. you can try that it will helps you.

download Source