Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 6-Mar-13 20:36pm
v3

1 solution

 
Share this answer
 
Comments
Sugu.s 7-Mar-13 5:01am    
Hi Maciej,

Thanks for reply. Actually my form contains Label, Textbox and Checkbox.
All the label texts are exported but textbox texts are not exported to PDF.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900