EDN Admin
Well-known member
I have used vs2010. I want to convert HTML Form to PDF or Image File using itextsharp. Conversion to PDF is working but the Textbox and Checkbox controls are not converted.
My code for Convert to PDF is,
Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)
PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream)
pdfDoc.Open()
Dim htmlarraylist As ArrayList = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(New StringReader(Div.InnerHtml), Nothing)
For k As Integer = 0 To htmlarraylist.Count - 1
pdfDoc.Add(DirectCast(htmlarraylist(k), IElement))
Next
pdfDoc.Close()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=Document.pdf")
System.Web.HttpContext.Current.Response.Write(pdfDoc)
Response.Flush()
Response.[End]()
Kindly advice me, how the HTML Form with controls are convert to PDF or image file.
Thanks in advance.
View the full article
My code for Convert to PDF is,
Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)
PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream)
pdfDoc.Open()
Dim htmlarraylist As ArrayList = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(New StringReader(Div.InnerHtml), Nothing)
For k As Integer = 0 To htmlarraylist.Count - 1
pdfDoc.Add(DirectCast(htmlarraylist(k), IElement))
Next
pdfDoc.Close()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=Document.pdf")
System.Web.HttpContext.Current.Response.Write(pdfDoc)
Response.Flush()
Response.[End]()
Kindly advice me, how the HTML Form with controls are convert to PDF or image file.
Thanks in advance.
View the full article