[
https://issues.apache.org/jira/browse/PDFBOX-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13671313#comment-13671313
]
Ole-Martin Mørk commented on PDFBOX-1616:
-----------------------------------------
We are trying hard to reproduce this issue in a small amount of sample code,
but no success yet. It's easily reproduced in our production code, but we can't
share that at the moment.
Some findings though
1. The bug is reproduced when using a truetypefont as well
2. It is NOT reproduced when writing to a pdf that only contain an image.
Point 2 leads me to think that it might connected to the embedded fonts in the
document.. Looking further into that..
> NumberFormatException i CMapParser.parseNextToken()
> ---------------------------------------------------
>
> Key: PDFBOX-1616
> URL: https://issues.apache.org/jira/browse/PDFBOX-1616
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 1.8.1
> Reporter: Thomas Fossum
>
> When using PDType1Font (any of the 14 fonts available), and adding text with
> contentStream.drawString(), we get a NumberformatException for string with 9
> characters, ex. "123456789" or "abcdefghi"
> Stacktrace:
> Caused by: java.lang.NumberFormatException: For input string: "8900146484"
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:495)
> at java.lang.Integer.<init>(Integer.java:677)
> at
> org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:541)
> at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:119)
> at org.apache.pdfbox.pdmodel.font.PDFont.parseCmap(PDFont.java:603)
> at
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.extractToUnicodeEncoding(PDSimpleFont.java:458)
> at
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.determineEncoding(PDSimpleFont.java:426)
> at org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:194)
> at
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.<init>(PDSimpleFont.java:88)
> at
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:65)
> at
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:108)
> at
> org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:203)
> at org.apache.pdfbox.pdmodel.PDResources.addFont(PDResources.java:588)
> at org.apache.pdfbox.pdmodel.PDResources.addFont(PDResources.java:574)
> at
> org.apache.pdfbox.pdmodel.edit.PDPageContentStream.setFont(PDPageContentStream.java:308)
> Issue https://issues.apache.org/jira/browse/PDFBOX-1225 handles a similar
> error: An attempt to Integer.parseString() is made with a value >
> Integer.MAX_VALUE.
> Line 541 in CMAPParser.java should probably use Long datatype.
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira