title: CSS styles are not being applied using iTextSharp
body: <p>I am creating a PDF document using iTextSharp however my CSS styles are not being applied, specifically the background colors.</p>
  
  <pre><code>protected void btnMail_Click(object sender, EventArgs e)
  {
      Response.Clear();
      try
      {
          if (Session["Projectname"] != null &amp;&amp; Session["Projectname"].ToString() != string.Empty)
          {
              string Projname = Session["Projectname"].ToString();
              Response.ContentType = "application/pdf";
              Response.AddHeader("content-disposition", "attachment;filename=" + Projname + ".pdf");
              Response.Cache.SetCacheability(HttpCacheability.NoCache);
              System.IO.StringWriter stringWrite = new System.IO.StringWriter();
              System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
              design.RenderControl(htmlWrite);
              StringReader sr = new StringReader(stringWrite.ToString());
              Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
              HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
              PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
              string strBuilder = stringWrite.ToString();
              string strPath = Request.PhysicalApplicationPath + "\\Temp\\WeeklyReport of " + Projname + ".pdf";
              PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(strPath, FileMode.Create));
              pdfDoc.Open();
              htmlparser.Parse(sr);
              pdfDoc.Close();
              pdfDoc.Dispose();
             Response.Write(pdfDoc);
              LblNoteMsg.Text = strPath;
              DateTime input = DateTime.Now;
              int delta = DayOfWeek.Monday - input.DayOfWeek;
              DateTime dats = DateTime.Now.AddDays(delta);
              DateTime monday = input.AddDays(delta);
              string MonDate = monday.ToShortDateString();
              DateTime sat = monday.AddDays(5);
              string SatDate = sat.ToShortDateString();
              StreamReader r = new StreamReader(Server.MapPath("~/WeeklyMail.txt"));
              string body = r.ReadToEnd();
              MailMessage Msg = new MailMessage();
              string MailId = txtMailId.Text;
              foreach (string ss in MailId.Split(",".ToCharArray()))
              {
                  if (string.IsNullOrEmpty(ss) == false)
                  {
                      Msg.To.Add(new MailAddress(ss));
                  }
              }
          }
      }
  }
  </code></pre>