title: iText style parsing HTML to PDF
body: <p>I've a problem with iText.</p>
  
  <p>I've followed this link: <a href="https://stackoverflow.com/questions/10493837/how-to-export-html-page-to-pdf-format">How to export html page to pdf format?</a></p>
  
  <p>My snippet:</p>
  
  <pre><code>    String str = "&lt;html&gt;&lt;head&gt;&lt;body&gt;&lt;div style=\"width:100%;height:100%;\"&gt;&lt;h3 style=\"margin-left:5px;margin-top:40px\"&gt;First&lt;/h3&gt;&lt;div style=\"margin-left:15px;margin-top:15px\"&gt;&lt;title&gt;&lt;/title&gt;&lt;p&gt;sdasdasd shshshshdffgdfgd&lt;/p&gt;&lt;/div&gt;&lt;h3 style=\"margin-left:5px;margin-top:40px\"&gt;The dream&lt;/h3&gt;&lt;div style=\"margin-left:15px;margin-top:15px\"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/head&gt;&lt;/html&gt;";
      String fileNameWithPath = "/Users/cecco/Desktop/pdf2.pdf";
  
  
      com.itextpdf.text.Document document =
              new com.itextpdf.text.Document(com.itextpdf.text.PageSize.A4);
      FileOutputStream fos = new FileOutputStream(fileNameWithPath);
      com.itextpdf.text.pdf.PdfWriter pdfWriter =
              com.itextpdf.text.pdf.PdfWriter.getInstance(document, fos);
  
      document.open();
  
      document.addAuthor("Myself");
      document.addSubject("My Subject");
      document.addCreationDate();
      document.addTitle("My Title");
  
      com.itextpdf.text.html.simpleparser.HTMLWorker htmlWorker =
              new com.itextpdf.text.html.simpleparser.HTMLWorker(document);
      htmlWorker.parse(new StringReader(str.toString()));
  
      document.close();
      fos.close();
  </code></pre>
  
  <p>and work fine.</p>
  
  <p>But tag style into h3 and div aren't considered.</p>
  
  <p><img src="https://i.stack.imgur.com/uD3fw.png" alt="enter image description here"> </p>
  
  <p>But if I copy my html into <a href="http://htmledit.squarefree.com/" rel="nofollow noreferrer">http://htmledit.squarefree.com/</a> all is correct.</p>
  
  <p>How can I solve this problem?</p>