Daniel Persson created PDFBOX-3511:
--------------------------------------
Summary: NullPointerException - missing glyph description
Key: PDFBOX-3511
URL: https://issues.apache.org/jira/browse/PDFBOX-3511
Project: PDFBox
Issue Type: Bug
Components: FontBox
Affects Versions: 2.0.3, 2.0.2, 2.0.1, 2.0.0
Reporter: Daniel Persson
Priority: Minor
Hi Team.
We process many PDF documents every day and today we ran into a file that we
couldn't create an image to. For some reason it has glyphs that didn't have any
glyph description.
In GlyfCompositeDescript there is atleast two functions (Line 258, 271) that
fetch an GlyphDescription from a map like this:
GlyphDescription gd = descriptions.get(c.getGlyphIndex());
Then the functions use the description without a null check which results in an
NullPointer exception.
Exception in thread "main" java.lang.NullPointerException
at
org.apache.fontbox.ttf.GlyfCompositeDescript.getCompositeCompEndPt(GlyfCompositeDescript.java:272)
at
org.apache.fontbox.ttf.GlyfCompositeDescript.getEndPtOfContours(GlyfCompositeDescript.java:126)
at org.apache.fontbox.ttf.GlyphRenderer.describe(GlyphRenderer.java:72)
at org.apache.fontbox.ttf.GlyphRenderer.getPath(GlyphRenderer.java:56)
at org.apache.fontbox.ttf.GlyphData.getPath(GlyphData.java:116)
at
org.apache.pdfbox.pdmodel.font.PDCIDFontType2.getPath(PDCIDFontType2.java:446)
at
org.apache.pdfbox.pdmodel.font.PDType0Font.getPath(PDType0Font.java:506)
at
org.apache.pdfbox.rendering.TTFGlyph2D.getPathForGID(TTFGlyph2D.java:137)
at
org.apache.pdfbox.rendering.TTFGlyph2D.getPathForCharacterCode(TTFGlyph2D.java:93)
at
org.apache.pdfbox.rendering.PageDrawer.drawGlyph2D(PageDrawer.java:353)
at
org.apache.pdfbox.rendering.PageDrawer.showFontGlyph(PageDrawer.java:334)
at
org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:744)
at
org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:701)
at
org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:564)
at
org.apache.pdfbox.contentstream.operator.text.ShowText.process(ShowText.java:55)
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.rendering.PageDrawer.drawPage(PageDrawer.java:189)
at
org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:145)
at
org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:94)
at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:236)
at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:94)
So far we have only seen one file with this issue in our processing. I've tried
to run the PDFToImage with all versions of PDFBox 2 and they fail.
PDFBox 1.8.12 gives some error output but generates an working image.
Sep 23, 2016 7:36:53 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
INFO: unsupported/disabled operation: BDC
Sep 23, 2016 7:36:53 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
INFO: unsupported/disabled operation: EMC
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <•> from <null> to the default font
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <•> from <null> to the default font
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <•> from <null> to the default font
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <•> from <null> to the default font
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <•> from <null> to the default font
Sep 23, 2016 7:36:55 AM org.apache.pdfbox.util.PDFImageWriter writeImage
INFO: Writing: [Removed Identifer]_01_07_201609231.jpg
At the time of writing the bug report the file is to fresh to disclose. Might
be able to add it in a week or so depending on the customer, and if it's
required for the resolution of this issue.
Thanks for your time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]