protected void ExportHTMLtoPDF() { Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + HttpContext.Current.Session["StudentID"].ToString() + ".pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); frmPrint.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A3, 0f, 0f, 0f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter writer; PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); 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)