title: Some HTML and CSS styles not applied when creating PDF document by iText
body: <p>I'm having an issue with iText when generating PDF from HTML. I'm passing the  "import information section" from Locize, which contains bold tags and list bullet</p>
  
  <pre><code>&lt;li&gt;\n                    
     &lt;b&gt;Toll-free&lt;/b&gt; (within Canada and the USA): 
     &lt;b&gt;1.800.xxxxxxx&lt;/b&gt;\n                
  &lt;/li&gt;\n  
  </code></pre>
  
  <p>The pdf file is generated in Confirmation.cs. The parameter "medSrc" passing from Confirmation.cs to ImportantInformation.cs is listed below. Somehow, the bold style and the list bullets just don't apply to the outcome pdf file. </p>
  
  <p>I have been debugging this for a while and still no clue about what's going on. Does anyone know what I missed? </p>
  
  <p>Thank you in advance!</p>
  
  <p>Confirmation.cs</p>
  
  <pre><code>    ...
      namespace xxx.Pdf.xxx.xxx
      {
      public partial class Confirmation
      {
          private IApplication application;
  
          public Confirmation(IApplication application)
          {
              this.application = application;
          }
  
          public byte[] Create()
          {
              var memoryStream = new MemoryStream();
              var css = Content.Css;
  
              //Create Document
              PdfDocument pdfDocument = new PdfDocument(new PdfWriter(memoryStream));
              PageSize pageSize = PageSize.LETTER;
              Document document = new Document(pdfDocument, pageSize);
  
              Header headerHandler = new Header(document);
              PageXofY footerHandler = new PageXofY(pdfDocument);
              document.SetTopMargin(headerHandler.GetTableHeight());
  
              //Assign event-handlers
              pdfDocument.AddEventHandler(PdfDocumentEvent.START_PAGE, headerHandler);
              pdfDocument.AddEventHandler(PdfDocumentEvent.END_PAGE, footerHandler);
  
             ...
              // ======&gt;Important Information &lt;=======
              var importantInfo = new ImportantInformation();
              Table impInfoTable = importantInfo.CreateTable(
                  HtmlUtility.MergeCssWithHtml(css, Content.ImportantInformationEmergencyMedical),
                  HtmlUtility.MergeCssWithHtml(css, Content.ImportantInformationTripCancellation));
  
              document.Add(impInfoTable).Add(new Paragraph("\n"));
  
              //set column parameters
              float offset = 36;
              float columnWidth = (pageSize.GetWidth() - offset * 2 + 15) / 2;
              float columnHeight = pageSize.GetHeight() - offset * 2;
              float tableWidth = columnWidth - 10;
  
              //define column area
              Rectangle[] columns = new Rectangle[]
              {
                  new Rectangle(offset , offset, columnWidth, columnHeight),
                  new Rectangle(columnWidth + 30, offset, columnWidth, columnHeight)
              };
              document.SetRenderer(new ColumnDocumentRenderer(document, columns));
  
              document.Add(new AreaBreak(AreaBreakType.LAST_PAGE));
  
              foreach (Applicant applicant in application.Applicants)
              {
                  ApplicantTable applicantTable = new ApplicantTable();
                  Table table = applicantTable.CreateTable(applicant, tableWidth);
                  //Table another = applicantTable.CreateTable(application.Applicants[1], tableWidth);
  
                  document.Add(table).Add(new Paragraph("\n").SetFontSize(3));
              }
  
              footerHandler.WriteTotal(pdfDocument);
  
              document.Close();
  
              pdfDocument.Close();
  
              var pdf = memoryStream.ToArray();
  
              return pdf;
          }
      }
  }
  </code></pre>
  
  <p>ImportantInformation.cs</p>
  
  <pre><code>...
  namespace xxx.xxx.xxx.Pdf
  {
      public class ImportantInformation
      {
      public Table CreateTable(string medSrc, string tciSrc)
      {
          float[] colWidth = new float[] { 50f, 50f };
          Table table = new Table(UnitValue.CreatePercentArray(colWidth));
          table.SetWidth(new UnitValue(UnitValue.PERCENT, 100));
  
          PdfFont avenir = FontFactory.CreateAvenirLightStandardMedium();
  
          Paragraph title = new Paragraph().Add("**IMPORTANT INFORMATION**").SetFontSize(12).SetFont(avenir).SetBold().SetTextAlignment(TextAlignment.CENTER);
          Cell titleCell = new Cell(1, 2).Add(title).SetBorder(Border.NO_BORDER);
          table.AddCell(titleCell);
  
          Cell medImportantinfo = new Cell()
              .SetBorder(Border.NO_BORDER)
              .Add(new Paragraph("Paragraph A")
              .SetFirstLineIndent(10f)
              .SetBold()
              .SetFontSize(9)
              .SetFont(avenir));
          Cell tciImportantInfo = new Cell()
              .SetBorder(Border.NO_BORDER)
              .Add(new Paragraph("Paragraph B")
              .SetFirstLineIndent(10f)
              .SetBold()
              .SetFontSize(9)
              .SetFont(avenir));
  
          IList&lt;IElement&gt; medInfo = HtmlToCellFormat.HtmlToElements(medSrc);
  
          IList&lt;IElement&gt; tciInfo = HtmlToCellFormat.HtmlToElements(tciSrc);
  
          foreach (IElement e in medInfo)
          {
              medImportantinfo.ElementToCell(e);
          }
  
          foreach (IElement e in tciInfo)
          {
              tciImportantInfo.ElementToCell(e);
          }
  
          table.AddCell(medImportantinfo).AddCell(tciImportantInfo);
  
          return table;
          }
      }
  }
  </code></pre>
  
  <p>The medSrc:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;\n    
      &lt;ul style=\"text-align: justify; list-style-type: disc; font-family: avenir, Arial, Helvetica, sans-serif; font-size: 10px\"&gt;\n        
          &lt;li&gt;\n            In the event of a medical emergency contact:\n            
              &lt;ul style=\"text-align: justify; list-style-type: circle; font-family: avenir, Arial, Helvetica, sans-serif; font-size: 10px\"&gt;\n                
                  &lt;li&gt;\n                    
                      &lt;b&gt;Toll-free&lt;/b&gt; (within Canada and the USA): 
                      &lt;b&gt;1.800xxxxxx&lt;/b&gt;\n                
                  &lt;/li&gt;\n                
                  &lt;li&gt;\n                    
                      &lt;b&gt;Collect&lt;/b&gt; (from all other locations): 
                      &lt;b&gt;1.xxxxxx&lt;/b&gt;\n                
                  &lt;/li&gt;\n            
              &lt;/ul&gt;\n        
          &lt;/li&gt;\n        
          ...
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Updates:
  Here is the definition for the functions of ElementToCell and HtmlToElements</p>
  
  <pre><code>public static class HtmlToCellFormat
  {
      public static string baseUri = "/";
  
      public static void ElementToCell(this Cell cell, IElement e)
      {
          var type = e.GetType().ToString();
          if (e.GetType() == typeof(Image))
          {
  
              cell.Add((Image)e);
          }
          else if (e.GetType() == typeof(Paragraph) || (e.GetType() == typeof(List)))
          {
              cell.Add((IBlockElement)e);
          }
      }
  
      public static IList&lt;IElement&gt; HtmlToElements(string content)
      {
          ConverterProperties properties = new ConverterProperties();
          properties.SetBaseUri(baseUri);
          FontProvider fontProvider = new DefaultFontProvider(false, false, false);
          FontProgram fontProgram = FontProgramFactory.CreateFont();
          fontProvider.AddFont(fontProgram, "");
          properties.SetFontProvider(fontProvider);
          IList&lt;IElement&gt; elements = HtmlConverter.ConvertToElements(content, properties);
          return elements;
      }
  }
  </code></pre>