title: Java : BOLD with iText in PDF Generation doesn't work correctly
body: <p>I use iText for generating PDF, from a XML file, with content in HTML. Everything is working, except one little thing.<br>
  When I have a bloc of text containing a part in BOLD, the BOLD doesn't appear in the resulting PDF file. If I have a complete phrase in BOLD, it's working fine.<br>
  Examples :  </p>
  
  <pre><code>&lt;DIV&gt;&lt;FONT face='Arial' size='10'&gt;&lt;B&gt;The BOLD for this phrase works&lt;/B&gt;&lt;/FONT&gt;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;FONT face='Arial' size='10'&gt;The BOLD for &lt;B&gt;this part of the phrase &lt;/B&gt; doesn't work&lt;/FONT&gt;&lt;/DIV&gt;  
  </code></pre>
  
  <p>With 'Italic' or 'Underline', I can do the same test but I don't have the problem. It's working...<br>
  A little precision : if I use a tag <code>&lt;B&gt;</code> combined with a tag <code>&lt;U&gt;</code> or <code>&lt;I&gt;</code>, for a part of bloc of text, it's working too.<br>
  Example :  </p>
  
  <pre><code>&lt;DIV&gt;&lt;FONT face='Arial' size='10'&gt;The combination of &lt;B&gt;&lt;I&gt;BOLD and something else (U or I)&lt;/I&gt;&lt;/B&gt; works fine.&lt;/FONT&gt;&lt;/DIV&gt;
  </code></pre>
  
  <p><BR/>
  For the context : WebApp with struts, the PDF is not saved as a file but sent to the navigator as a response. As suggested by an answer, I update my version of iText from 1.4.8 to 5.5.7.<br>
  For the HTML code saved in a xml file, you can see examples above.<br>
  For the Java code (I picked up the code from severals long methods. I hope I forgot nothing...).  </p>
  
  <pre><code>ByteArrayOutputStream baoutLettre = new ByteArrayOutputStream();  
  Document document = new Document();  
  PdfWriter myWriter = PdfWriter.getInstance(document, baoutLettre);  
  handleHeaderFooter(request, response, document, Constantes.Type_LETTRE);  
  document.open();  
  String lettreContent = FileHelper.readFile("myLetter.xml");  
  XmlParser.parse(document, new ByteArrayInputStream(lettreContent.getBytes("UTF-8")), getTagMap());
  document.close();
  ByteArrayOutputStream outTmp = new ByteArrayOutputStream(64000);
  PdfCopyMerge pdfCM = new PdfCopyMerge(outTmp);
  pdfCM.addDocument(baoutLettre.toByteArray());
  pdfCM.close();
  ByteArrayOutputStream outPDF = addPageNumber(outTmp.toByteArray(), soc, dicoEdition, request);
  outPDF.writeTo(request.getOutputStream());
  </code></pre>
  
  <p>And for the class PdfCopyMerge :  </p>
  
  <pre><code>public class PdfCopyMerge {
  
  private ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  private Document document = null;
  private PdfCopy writer = null;
  
  public PdfCopyMerge(ByteArrayOutputStream stream) {
      super();
      outStream = stream;
  }    
  public int addDocument(byte[] pdfByteArray) {
      int numberOfPages = 0;
      try {
          PdfReader reader = new PdfReader(pdfByteArray);
          numberOfPages = reader.getNumberOfPages();
          if (this.document == null) {
              this.document = new Document(reader.getPageSizeWithRotation(1));
              this.writer = new PdfCopy(this.document, this.getOutputStream());
              this.document.open();
          }
          PdfImportedPage page;
         for (int i = 0; i &lt; numberOfPages;) {
             ++i;
             page = this.writer.getImportedPage(reader, i);
             this.writer.addPage(page);
         }
         PRAcroForm form = reader.getAcroForm();
         if (form != null) {
             this.writer.copyAcroForm(reader);
         }
     } catch (Exception e) {
        logger.error(e.getMessage(),e);
     }
      return numberOfPages;
  }
  </code></pre>
  
  <p>Does anybody face the same problem ? I look for any helping ideas ...<br>
  Thanks.</p>