Mohammad Aman

Mohammad Aman

  • Tech Writer
  • 327
  • 72.4k

iTextSharp text html simpleparser HTML is absolete not worki

Mar 1 2016 3:21 AM
<pre lang="C#">&lt;pre lang=&quot;C#&quot;&gt;I am using itexhsharp to generate , On local server it is working but giving me warning iTextSharp.text.html.simpleparser.HTMLWorker is absolote and On the server it is not working and not generating pdf file any one can give me solutions for this error&lt;/pre&gt;</pre>
My code is here :
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=Vasundhara" + Date.Today + ".pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
repeaterName.RenderControl(hw)
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New Document(PageSize.A4, 50.0F, 50.0F, 40.0F, bottom)
Dim htmlparser As New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
Try
htmlparser.Parse(sr)
Catch ex As Exception
Finally
pdfDoc.Close()
End Try
'htmlparser.Parse(sr)
'pdfDoc.Close()
Response.Write(pdfDoc)
Response.End()

Answers (3)