protected void btnExport_Click(object sender, EventArgs e) { StringWriter sw = new StringWriter(); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr); pdfDoc.Close(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=HTML.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.End();
pdfDoc.Close();
using iTextSharp.tool.xml;
StringWriter
StringReader
ParseXHtml
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)