pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: java.lang.NullPointerException at org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:343)
Date Tue, 31 Dec 2013 11:50:16 GMT
Hi,

Am 31.12.2013 02:36, schrieb alex@lanin.de:
>
> Hi,
>
> this is pretty much my first day with pdfbox but I can't find anything obvious
> I'm doing wrong.
Welcome to our community!

> I'm attempting to display a pdf file, which works quite fine with some pdfs.
> I've already switched to 2.0.0 trunk (from git) in the hopes of getting better
> results. So the below problem refers to commit "PDFBOX-1808: close the PDF not
> until the end of the test" aka 3fd34c9ff38227e9bd1e6d853ae85a0a9ee8ede7 on git.
Why do you think it's related to PDFBOX-1808? Does it work without those changes?

> Dez 31, 2013 2:18:10 AM org.apache.pdfbox.util.PDFStreamEngine processEncodedText
> Warnung: java.lang.NullPointerException
> java.lang.NullPointerException
>      at
> org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:343)
>      at org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:45)
>      at
> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:529)
>      at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:258)
>      at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:225)
>      at
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:205)
>      at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:152)
>      at org.apache.pdfbox.util.RenderUtil.renderPage(RenderUtil.java:213)
>      at org.apache.pdfbox.util.RenderUtil.convertToImage(RenderUtil.java:177)
>
> the null pointer lines are:
> spaceWidthText = (font.getSpaceWidth() * glyphSpaceToTextSpaceFactor);
> spaceWidthText = (font.getAverageFontWidth() * glyphSpaceToTextSpaceFactor);
>
> So I'm guessing font is null.
Sounds reasonable, but I guess it's maybe another issue. Did you ever try to use 
the non-sequential (-nonSeq on the commandline/PDDocument#loadNonSeq insteed of 
PDDocument#load within your own source) parser?
If the issue still persists we need to get a hand on the pdf in question. 
Otherwise it'll be hard/impossible to figure out whta the problem cound be.

> Result of this bug(!?) is a nicely shown background but absolutely no text in
> the pdf.
No font, no text. Doesn't suprise me ;-)

> Regards,
> Alex

BR
Andreas Lehmkühler


Mime
View raw message