title: ITextSharp XMLWorkerHelper Not Working
body: <p>I am trying to convert an HTML page to PDF.  I am trying to utilize the XMLWorker.  I am following various examples I see around the web.  For some reason, however, the XMLWorkerHelper object seems to think that my PDFWriter object is actually an IElementHandler object.  Because of this, it won't compile.  I don't know what is wrong.  Has anyone experienced this? How do I convince the XMLWorkerHelper that my PDFWriter is in fact a PDFWriter?  Here is my code:</p>
  
  <pre><code>Imports System.IO
  Imports iTextSharp.text
  Imports iTextSharp.text.pdf
  Imports iTextSharp.tool.xml
  
  
      Dim bytes As Byte()
  
      Using ms = New MemoryStream
          Using doc = New Document
              Using writer = PdfWriter.GetInstance(doc, ms)
  
                  doc.Open()
  
                  Using msCSS As New MemoryStream(System.Text.Encoding.UTF8.GetBytes(CSSstr))
                      Using msHTML As New MemoryStream(System.Text.Encoding.UTF8.GetBytes(HTMLstr))
  
                         'This Doesn't Work...
                         iTextSharp.tool.xml.XMLWorkerHelper.GetInstance().ParseXHtml(writer, doc, msHTML, msCSS)
  
                      End Using
                  End Using
  
                  doc.Close()
  
              End Using
          End Using
  
          bytes = ms.ToArray
  
      End Using
  </code></pre>