title: How create PDF/A file from HTML using iTextSharp
body: <p>I want to create PDF/A from HTML using iTextsharp, but is having a hard time creating something that validateds to PDF/. This is the code that I use to test the functionality. What needs to be changed to get what I want?</p>
  
  <pre><code>    static void Main(string[] args)
      {
          //create stylesheet (used to change font from default Helvetica in order to embed font in PDF/A)
          var styles = new StyleSheet();
          var fontPath = Environment.GetEnvironmentVariable("SystemRoot") + "\\fonts\\verdana.ttf";
          FontFactory.Register(fontPath);
          styles.LoadTagStyle("body", "face", "Verdana");
  
  
          var pdFdocument = new Document(PageSize.A4);
          const string strPdFpath = @"MyPDF.pdf-PDFX1A2001";
          var sr = new StringReader("&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Dette er en HTML-fil&lt;/h1&gt;&lt;p&gt;Dette er litt tekst i html-fila&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Dette er enda ett avsnitt. iTextSharp ser ut til å fungere greit...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;");
  
          var htmlParser = new HTMLWorker(pdFdocument, null, styles);
          PdfWriter writer = PdfWriter.GetInstance(pdFdocument, new FileStream(strPdFpath, FileMode.OpenOrCreate));
          writer.PDFXConformance = PdfWriter.PDFX1A2001;
          pdFdocument.Open();
          htmlParser.Parse(sr);
          pdFdocument.Close();
      }
  </code></pre>