title: Invalid nested tag head found
body: <p>I'm trying to convert a webpage to PDF using VB.NET and iTextSharp. I tried so many different examples and nothing seems to be working (for me at least). This is the closest I got, but the XMLWorkerHelper always throws the exception <code>Invalid nested tag head found, expected closing tag script</code>, no matter which web page is parsed.</p>
  
  <pre><code>Dim webClient As New System.Net.WebClient      
  Dim result As String = webClient.DownloadString("http://google.com")        
  Dim doc As New Document(PageSize.A4)
  Dim writer As PdfWriter = PdfWriter.GetInstance(doc, New System.IO.FileStream("c:\test.pdf", System.IO.FileMode.Create))
  Dim sr As New System.IO.StringReader(result)
  Try
      XMLWorkerHelper.GetInstance().ParseXHtml(writer, doc, sr)
  Catch ex As Exception
  
  End Try
  </code></pre>
  
  <p>I'm using iTextSharp 5.4.2.0 and .NET Framework 4.</p>
  
  <p>Thanks</p>