title: Invalid nested tag div found, expected closing tag script exception in itextsharp XMLWorkerHelper
body: <p>I am converting sharepoint aspx page content to pdf using the below code but while parsing the htmlstring its throwing this error: "Invalid nested tag div found, expected closing tag script" How can I handle this kind of invalid tag or tag closing issue thru the C# code, so that I can pass the valid htmlString to the method.</p>
  
  <pre><code>//Create a byte array that will eventually hold our final PDF
  Byte[] bytes;
  //Boilerplate iTextSharp setup here
  //Create a stream that we can write to, in this case a MemoryStream
  using (var ms = new MemoryStream()) {
      //Create an iTextSharp Document which is an abstraction of a PDF but **NOT** a PDF
      using (var doc = new Document()) {
          //Create a writer that's bound to our PDF abstraction and our stream
          using (var writer = PdfWriter.GetInstance(doc, ms)) {
              //Open the document for writing
              doc.Open();
  
              //Our sample HTML
              var example_html = GetHtmlSource(HttpContext.Current.Request.Url.ToString());                  
              using (var srHtml = new StringReader(example_html)) {
                  //Parse the HTML
                  iTextSharp.tool.xml.XMLWorkerHelper.GetInstance().ParseXHtml(writer, doc, srHtml);   **In this line throwing exception**
              }                                         
          } 
          doc.Close();
      }
  }    
  bytes = ms.ToArray();
  </code></pre>