[ https://issues.apache.org/jira/browse/PDFBOX-3513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15527249#comment-15527249 ]
Tilman Hausherr commented on PDFBOX-3513: ----------------------------------------- The PDF specification is contradictory there: in page 259, the middle column has "name or dictionary" and the right column has {quote} (Required) An encoding dictionary whose Differences array shall specify the complete character encoding for this font (see 9.6.6, "Character Encoding"). {quote} On the other hand, we've never encountered a file with the problem you've presented. > PDFType3Font can have Encoding which is not a COSDictionary > ----------------------------------------------------------- > > Key: PDFBOX-3513 > URL: https://issues.apache.org/jira/browse/PDFBOX-3513 > Project: PDFBox > Issue Type: Bug > Components: PDModel > Affects Versions: 2.0.3 > Reporter: Emanuel Greisen > > I tried the "ExtractTextByArea" with a PDF from my bank and go the following > stacktrace: > {code} > Exception in thread "main" java.lang.ClassCastException: > org.apache.pdfbox.cos.COSName cannot be cast to > org.apache.pdfbox.cos.COSDictionary > at > org.apache.pdfbox.pdmodel.font.PDType3Font.readEncoding(PDType3Font.java:70) > at > org.apache.pdfbox.pdmodel.font.PDType3Font.<init>(PDType3Font.java:57) > at > org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:79) > at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143) > at > org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149) > at > org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:139) > at > org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:391) > at > org.apache.pdfbox.text.PDFTextStripperByArea.extractRegions(PDFTextStripperByArea.java:130) > {code} > I can read the PDF with evince, pdftk, lesspipe to extract text. I cannot > upload the file as it is a bank statement with content I will not share. > Debugging the application I found that the return from PDType3Font.java:69 > {code} > dict.getDictionaryObject(COSName.ENCODING) > {code} > Is an object of type: "COSName" with the name property set to > "WinAnsiEncoding". > I hope this helps - despite the fact that I cannot share the example PDF. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org