.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Export GridView Data into PDF Document in ASP.Net

Posted By: Sasi Prabhu     Posted Date: June 08, 2011    Points:5   Category :ASP.Net
I want to Convert the GridView DataSource value into PDF Format with out Using itextsharp.And Store the PDF File into Server.

Responses
Author: Gowthammanju             
Posted Date: June 08, 2011     Points: 20   

Hi,

u can refer the following articles for this purpose



Download Attachment

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Sasi Prabhu             
Posted Date: June 08, 2011     Points: 20   

Thanks for your Post.

In this attachment,
There is an itextshap.dll.
I need without using itextsharp.dll.

Thanks & Regards,
Sasi Prabhu.
Author: Gowthammanju             
Posted Date: June 08, 2011     Points: 20   

With out using those reference or any thrid party tool u can not be able to generate pdf

for this u must create ur own dll which retrify ur problem

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Sasi Prabhu             
Posted Date: June 09, 2011     Points: 20   

i'm tried this code....
But i got the runat server tag error.

 Response.Clear();
Response.AddHeader("content-disposition", "attachment;
filename=FileName.pdf");
Response.Charset = "";
Response.ContentType = "application/pdf";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();



Thanks & Regards,
Sasi Prabhu.
Author: Sasi Prabhu             
Posted Date: June 09, 2011     Points: 20   

This Code Gets a PDF File :

But i got error while opening the File.

string attachment = "attachment; filename=Contacts.xls";


Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/pdf";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();
GridView1.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(GridView1);
frm.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();




Thanks & Regards,
Sasi Prabhu.
Author: Susan Thampy             
Posted Date: June 09, 2011     Points: 20   
Author: arronlee             
Posted Date: November 04, 2015     Points: 20   

Thanks for your nice sharing. But I wonder do I need another pdf conversion sdk to help deal with those codes?
http://www.pqscan.com/convert-pdf/

Next Tomorrow is Another Day .


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend