title: Stack Empty exception on HTMLWorker in iTextSharp
body: <p>I am using this code to mail a datatable in the form of a pdf. But on converting the data using html parser, it is showing the exception as Stack Empty. However I have done this before and it worked, I just cant put my finger on what am I missing now. Please help!!!!!</p>
  
  <pre><code>using (StringWriter sw = new StringWriter())
      {
          using (HtmlTextWriter hw = new HtmlTextWriter(sw))
          {
              StringBuilder sb = new StringBuilder();
              //sb.Append("&lt;table width='100%' cellspacing='0' cellpadding='2'&gt;");
  
  
              foreach (DataColumn column in dt.Columns)
              {
                  //sb.Append("&lt;th style = 'background-color: #D20B0C;color:#ffffff'&gt;");
                  sb.Append(column.ColumnName);
                  sb.Append("&lt;/th&gt;");
              }
              sb.Append("&lt;/tr&gt;");
              foreach (DataRow row in dt.Rows)
              {
                  sb.Append("&lt;tr&gt;");
                  foreach (DataColumn column in dt.Columns)
                  {
                      sb.Append("&lt;td&gt;");
                      sb.Append(row[column]);
                      sb.Append("&lt;/td&gt;");
                  }
                  sb.Append("&lt;/tr&gt;");
              }
              sb.Append("&lt;/table&gt;");
  
  
          using (MemoryStream memoryStream = new MemoryStream())
              {
                  PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream);
                  pdfDoc.Open();                    
                  htmlparser.Parse(sr);//here is the error
                  pdfDoc.Close();
                  byte[] bytes = memoryStream.ToArray();
                  memoryStream.Close();
  
                  MailMessage mm = new MailMessage(txtEmail.Text.Trim(), email.Trim());
                  mm.Subject = txtSubject.Text.Trim();
                  //mm.CC.Add = txtcc.Text.Trim();
                  mm.Body = txtBody.Text.Trim();
                  mm.Attachments.Add(new Attachment(new MemoryStream(bytes), "iTextSharpPDF.pdf"));
                  mm.IsBodyHtml = true;
                  SmtpClient smtp = new SmtpClient();
                  smtp.Host = "smtp.gmail.com";
                  smtp.EnableSsl = true;
                  NetworkCredential NetworkCred = new NetworkCredential();
                  NetworkCred.UserName = txtEmail.Text.Trim();
                  NetworkCred.Password = txtPassword.Text.Trim();
                  smtp.UseDefaultCredentials = true;
                  smtp.Credentials = NetworkCred;
                  smtp.Port = 587;
                  smtp.Send(mm);
              }
  </code></pre>
  
  <p>}
  }</p>