I meant delete the content of the method, but what you did is of course
fine too.
If your file is not confidential then it would be great that you'd open
an issue in JIRA an attach the file. I wonder if this is a broken font,
or an undiscovered bug in our IO handling.
Tilman
Am 03.03.2020 um 18:16 schrieb Philippe Fisher:
I tried deleting PageDrawer.showFontGlyph(), but then the project doesn't build
anymore. Wrapping the content of PageDrawer.showFontGlyph() with a try catch
worked perfectly!
@Override
protected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int
code, String unicode,
Vector displacement) throws IOException
{
try{
AffineTransform at = textRenderingMatrix.createAffineTransform();
at.concatenate(font.getFontMatrix().createAffineTransform());
Glyph2D glyph2D = createGlyph2D(font);
drawGlyph2D(glyph2D, font, code, displacement, at);
}catch (EOFException eofException){
System.err.println(eofException.getMessage());
}
}
Thanks for all the help,
Philippe Fisher
On 2020/03/03 15:34:33, Tilman Hausherr <thaush...@t-online.de> wrote:
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
---------------------------------------------------------------------
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