HtmlForm form_html = new HtmlForm(); form_html.Controls.Add(GridView1); string attachment = "attachment; filename=Article.pdf"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/pdf"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw = new HtmlTextWriter(stw); divtext.RenderControl(htextw); GridView1.RenderControl(htextw); Document document = new Document(PageSize.A4, 3f, 4f, 1f, 0f); PdfWriter.GetInstance(document, Response.OutputStream); document.Open(); StringReader str = new StringReader(stw.ToString()); HTMLWorker htmlworker = new HTMLWorker(document); htmlworker.Parse(str); document.Close(); Response.Write(document); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)