title: Error Generating PDF: ITextFontResolver: java.lang.RuntimeException: Font 'Courier-BoldOblique' with 'Cp1252' is not recognized
body: <p>Recently needed to make some library changes so that could use <code>Apache POI</code> for <code>docx</code> suppot.  This included changing <code>Itext</code> versions from <code>2.1.0</code> to <code>4.2.1</code>.</p>
  
  <p>Also using Grails Renderer Plugin with Flying Saucer.  From build.gradle:</p>
  
  <pre><code>compile 'org.xhtmlrenderer:flying-saucer-core:9.1.12'
  compile 'org.xhtmlrenderer:flying-saucer-pdf:9.1.12'
  compile 'org.xhtmlrenderer:flying-saucer-log4j:9.1.12'
  
  compile ('org.grails.plugins:rendering:2.0.3') {
      exclude group: 'org.xhtmlrenderer', module: 'core-renderer'
  }
  
  compile("com.lowagie:itext:4.2.1")
  </code></pre>
  
  <p>When generating a PDF I get the following Exception:</p>
  
  <pre><code>java.lang.RuntimeException: Font 'Courier-BoldOblique' with 'Cp1252' is not recognized.
      at org.xhtmlrenderer.pdf.ITextFontResolver.createInitialFontMap(ITextFontResolver.java:470) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextFontResolver.&lt;init&gt;(ITextFontResolver.java:40) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextRenderer.&lt;init&gt;(ITextRenderer.java:124) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextRenderer.&lt;init&gt;(ITextRenderer.java:110) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextRenderer.&lt;init&gt;(ITextRenderer.java:106) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextRenderer.&lt;init&gt;(ITextRenderer.java:102) ~[flying-saucer-pdf-9.1.12.jar:na]
  Caused by: com.lowagie.text.DocumentException: Font 'Courier-BoldOblique' with 'Cp1252' is not recognized.
      at com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:696) ~[itext-4.2.1.jar:na]
      at com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:603) ~[itext-4.2.1.jar:na]
      at com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:438) ~[itext-4.2.1.jar:na]
      at org.xhtmlrenderer.pdf.ITextFontResolver.createFont(ITextFontResolver.java:483) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextFontResolver.createFont(ITextFontResolver.java:479) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextFontResolver.addCourier(ITextFontResolver.java:491) ~[flying-saucer-pdf-9.1.12.jar:na]
      at org.xhtmlrenderer.pdf.ITextFontResolver.createInitialFontMap(ITextFontResolver.java:459) ~[flying-saucer-pdf-9.1.12.jar:na]
  </code></pre>
  
  <p>In looking at the code, the above exception happens from my code from</p>
  
  <pre><code>  ITextRenderer theRenderer = new ITextRenderer()
  </code></pre>
  
  <p>My code is running in a war deployed on Tomcat.  I can see the font files (like <code>Courier-BoldOblique.afm</code>, but they are in the jar <code>itext-4.2.1.jar</code> in <code>/com/lowagie/text/pdf/fonts</code>.</p>
  
  <p>How do I get the code to find the fonts correctly, so that the creation of <code>ITextRenderer</code> succeeeds?</p>