Hi, Try to delete the content of PageDrawer.showFontGlyph().
Tilman Am 03.03.2020 um 16:13 schrieb Philippe Fisher:
Hello, I am currently using pdfBox 2.0.18 to extract an image from the first page of pdf documents in order to create a thumbnail. For certain documents, the rendering fails like so: Exception in thread "main" java.io.EOFException: premature EOF at org.apache.fontbox.ttf.TTFDataStream.readUnsignedByte(TTFDataStream.java:132) at org.apache.fontbox.ttf.GlyfSimpleDescript.readFlags(GlyfSimpleDescript.java:204) at org.apache.fontbox.ttf.GlyfSimpleDescript.<init>(GlyfSimpleDescript.java:85) at org.apache.fontbox.ttf.GlyphData.initData(GlyphData.java:60) at org.apache.fontbox.ttf.GlyphTable.getGlyphData(GlyphTable.java:202) at org.apache.fontbox.ttf.GlyphTable.getGlyph(GlyphTable.java:182) at org.apache.pdfbox.pdmodel.font.PDCIDFontType2.getPath(PDCIDFontType2.java:408) at org.apache.pdfbox.pdmodel.font.PDType0Font.getPath(PDType0Font.java:576) at org.apache.pdfbox.rendering.TTFGlyph2D.getPathForGID(TTFGlyph2D.java:144) at org.apache.pdfbox.rendering.TTFGlyph2D.getPathForCharacterCode(TTFGlyph2D.java:93) at org.apache.pdfbox.rendering.PageDrawer.drawGlyph2D(PageDrawer.java:468) at org.apache.pdfbox.rendering.PageDrawer.showFontGlyph(PageDrawer.java:449) at org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:785) at org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:741) at org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:601) at org.apache.pdfbox.contentstream.operator.text.ShowText.process(ShowText.java:56) at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:875) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:509) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:483) at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:156) at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:270) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:321) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243) at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229) at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:262) at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:89) The pdf in question is an old document with text embeded on top of an image. Is there a way to bypass the text rendering since the background image is sufficient for the thumbnail? Also, I have been able to build the 3.x version of pdfBox from the SVN repo and that build throws the same exception, but does not crash and outputs an image. Could wrapping the method with a try catch be sufficient for my need? Thanks, Philippe Fisher --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org