title: iTextSharp 5 - how to convert HTML elements
body: <p>Using c# and nuget packages iTextSharp, itextsharp.pdfa and itextsharp.xmlworker, version 5.5.13, I generate a PDF document of the PDF/A standard. My problem is that some text has html tags, and should be converted to the PDF also. As my example show the text contains a html  tag, and should be converted to bold. How to do that? Maybe it is a possibility to use itext XMLWorkerHelper, if so, how to use it?</p>
  
  <pre><code>using System;
  using System.IO;
  using iTextSharp;
  using iTextSharp.text;
  using iTextSharp.text.pdf;
  using iTextSharp.tool.xml;
  
  namespace itext_html
  {
      class Program
      {
          static void Main(string[] args)
          {
              var baseFontArial = BaseFont.CreateFont(Environment.GetEnvironmentVariable("SystemRoot") + "\\fonts\\arial.ttf",
                                                  BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
              var arial7 = new Font(baseFontArial, 7);
              var stream = new FileStream(@"c:\temp\itext\itext.pdf", FileMode.Create);
  
              var doc = new Document(PageSize.A4);
              var pdfAWriter = PdfAWriter.GetInstance(doc, stream, PdfAConformanceLevel.PDF_A_1B);
              doc.Open();
  
              var outi = new PdfDictionary(PdfName.OUTPUTINTENT);
              outi.Put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1"));
              outi.Put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
              outi.Put(PdfName.S, PdfName.GTS_PDFA1);
              var icc = ICC_Profile.GetInstance(@"C:\Temp\itext\srgb.profile");
  
              pdfAWriter.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
  
              var table = new PdfPTable(2);
              table.SetWidths(new int[] { 65, 35 });
              var text1 = new Phrase("Hello World &lt;b&gt;bold text&lt;/b&gt;", arial7);
              var cell = new PdfPCell(text1);
              table.AddCell(cell);
              var text2 = new Phrase("Another text &lt;i&gt;italic text&lt;/i&gt;", arial7);
              cell = new PdfPCell(text2);
              table.AddCell(cell);
  
              doc.Add(table);
  
              //Add text with html elements
              doc.Add(new Phrase("Hello World &lt;b&gt;bold text&lt;/b&gt;", arial7));
              pdfAWriter.CreateXmpMetadata();
              doc.Close();
              pdfAWriter.Close();
          }
      }
  }
  </code></pre>