Click here to Skip to main content
14,924,336 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
for Exporting Table Data to PDF i wrote code like this

C#
HtmlForm form = new HtmlForm();
            string attachment = "attachment; filename=ExportPDf.pdf";
            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/pdf";
            StringWriter stw = new StringWriter();
            HtmlTextWriter htextw = new HtmlTextWriter(stw);
            form.Controls.Add(Table3);
            Table3.RenderControl(htextw);

            lblMessbody.RenderControl(htextw);

            Response.Write(stw.ToString());
            Response.End();


but it's not export to PDF format,

it shows the error like this AdobeReader could not open " .pdf" becz it is either not a supported file type or because the file has been damaged
Posted

There is no PDF support built in to .NET. You need to use an external library. Use google, there are free ones.
   
Comments
[no name] 20-Aug-12 7:14am
   
Thank u
AmitGajjar 20-Aug-12 7:43am
   
you can use iTextSharp. it's very popular.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900