Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1664

NullPointerException in PDType1Font.java

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2, 2.0.0
    • Fix Version/s: 1.8.5, 2.0.0
    • Component/s: PDModel
    • Labels:
      None
    • Environment:
      XP

      Description

      I get this with 1.8.2 with certain files:

      17.07.2013 11:48:54.406 WARN [main] org.apache.pdfbox.util.PDFStreamEngine:567 - java.lang.NullPointerException
      java.lang.NullPointerException
      at org.apache.pdfbox.pdmodel.font.FontManager.normalizeFontname(FontManager.java:136)
      at org.apache.pdfbox.pdmodel.font.FontManager.getAwtFont(FontManager.java:82)
      at org.apache.pdfbox.pdmodel.font.PDType1Font.getawtFont(PDType1Font.java:240)
      at org.apache.pdfbox.pdmodel.font.PDSimpleFont.drawString(PDSimpleFont.java:109)
      at org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:235)
      at org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:496)
      at org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:45)
      at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:554)
      at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
      at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
      at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
      at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:125)
      at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:781)
      at pdfboxpageimageextraction.ExtractImages.doPdf(ExtractImages.java:108)
      at pdfboxpageimageextraction.ExtractImages.main(ExtractImages.java:67)

      The cause [as of 19.8.2013] is in PageDrawer.java:

      awtFont = FontManager.getAwtFont(fd.getFontName());

      which fails because fd.getFontName() returns null.

      A fix (don't know if it is good or just the symptom) is to add this line above:

      if (fd.getFontName() != null)

      It happens with 1.8.2, and the 2.0.0 version that I downloaded on May 5th.

      I can't provide a file, because its confidential.
      [memo for me: it is file 287]

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: