Response.AddHeader("content-disposition", "attachment;filename=Report.pdf"); Response.ContentType = "application/pdf"; Response.Cache.SetCacheability(HttpCacheability.NoCache); System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); panelPrint.RenderControl(htmlWrite); System.IO.StringReader sr = new System.IO.StringReader(stringWrite.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 7f); //Document pdfDoc = new Document( HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)