[ 
https://issues.apache.org/jira/browse/PDFBOX-1161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Leleu resolved PDFBOX-1161.
--------------------------------

    Resolution: Fixed

Hi,

The ClassCastException occurred because the ~bfrange operator  doesn't have the 
right number of ranges. 

In the CMap, 2 ranges are declared but only one appear between the 
"beginbfrange" operator and the "endbfrange" operator.

2 beginbfrange
<0001> <0032> [<0052> ... <0041> ]
endbfrange

So I started from your patch proposal and I have added a control to check that 
the operator is the expected one. I have added this control to the following 
operators :
 ~cidchar
 ~cidrange
 ~bfchar
 ~codespacerange

Thank for your help,
BR,
Eric

                
> CMapParser exception when call extractToUnicodeEndoding
> -------------------------------------------------------
>
>                 Key: PDFBOX-1161
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1161
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 1.6.0
>         Environment: windows xp, JDK 1.5, eclipse
>            Reporter: philip huang
>            Assignee: Eric Leleu
>             Fix For: 1.7.0
>
>         Attachments: 17704628.pdf, Code.zip
>
>
> Open 17704628.pdf in PdfReader,  throws exception
> Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
> org.apache.fontbox.cmap.CMapParser$Operator
>       at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:172)
>       at org.apache.pdfbox.pdmodel.font.PDFont.parseCmap(PDFont.java:559)
>       at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.extractToUnicodeEncoding(PDSimpleFont.java:425)
>       at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.determineEncoding(PDSimpleFont.java:393)
>       at org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:189)
>       at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.<init>(PDSimpleFont.java:82)
>       at 
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:65)
>       at 
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:124)
>       at 
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
>       at org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:119)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:239)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:221)
>       at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:107)
>       at org.apache.pdfbox.pdfviewer.PDFPagePanel.paint(PDFPagePanel.java:96)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to