Protected Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click Response.ContentType = "application/pdf" 'Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf") Response.AddHeader("Content-Disposition", String.Format("online;filename=IncidentReport_{0}.pdf", DateTime.Now.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture))) Response.Cache.SetCacheability(HttpCacheability.NoCache) Dim sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) Panel1.RenderControl(hw) Dim sr As New StringReader(sw.ToString()) Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F) Dim htmlparser As New HTMLWorker(pdfDoc) PdfWriter.GetInstance(pdfDoc, Response.OutputStream) pdfDoc.Open() htmlparser.Parse(sr) pdfDoc.Close() Response.Write(pdfDoc) Response.End() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)