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

java.lang.ClassCastException: org.pdfbox.cos.COSString cannot be cast to org.pdfbox.cos.COSName

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.3
    • 0.8.0-incubator
    • None
    • None

    Description

      I'm getting this error parsing a pdf file,

      java.lang.ClassCastException: org.pdfbox.cos.COSString cannot be cast to org.pdfbox.cos.COSName
      at org.pdfbox.pdmodel.font.PDFont.getAFM(PDFont.java:330)
      at org.pdfbox.pdmodel.font.PDSimpleFont.getFontHeight(PDSimpleFont.java:104)
      at org.pdfbox.util.PDFStreamEngine.showString(PDFStreamEngine.java:336)
      at org.pdfbox.util.operator.ShowText.process(ShowText.java:64)
      at org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:452)
      at org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:215)
      at org.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:174)
      at org.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:336)
      at org.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:259)
      at org.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:216)
      at org.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:149)

      Unfortunately, I can't give you the pdf file, but the PDFFont->font->items map for the instance in question is,

      {COSName

      {FontDescriptor}

      =org.pdfbox.cos.COSDictionary@1041876, COSName

      {Subtype}

      =COSName

      {TrueType}

      , COSName

      {Widths}

      =COSArray{[COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      , COSInt

      {600}, COSInt{600}

      ]}, COSName

      {Encoding}

      =COSObject

      {4, 0}

      , COSName

      {FirstChar}

      =COSInt

      {0}

      , COSName

      {Type}

      =COSName

      {Font}

      , COSName

      {BaseFont}

      =COSString

      {Courier New,Bold}

      , COSName

      {LastChar}

      =COSInt{255}}

      Attachments

        Activity

          People

            Unassigned Unassigned
            sgbridges Sean Bridges
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: