pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PdfBox Nullpointer error
Date Thu, 21 Apr 2016 18:08:57 GMT
Could you upload the PDF file somewhere?

I'd make this change:

public int nameToGID(String name) throws IOException
     {
         // look up in 'post' table
         readPostScriptNames();
         if (postScriptNames != null)
         {
             Integer gid = postScriptNames.get(name);
             if (gid != null && gid > 0 && gid < 
getMaximumProfile().getNumGlyphs())
             {
                 return gid;
             }
         }


but I'm wondering what happens after that with your file.

Tilman

Am 21.04.2016 um 13:23 schrieb Szirbik Ferenc:
> Dear PdfBox Developers!
>
> I tried to use the PdfBox 2.0, but when i started to print a PDF a 
> NullPointerException had been thrown.
>
> Here is te stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.fontbox.ttf.TrueTypeFont.nameToGID(TrueTypeFont.java:580)
>     at 
> org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.codeToGID(PDTrueTypeFont.java:559)
>     at 
> org.apache.pdfbox.rendering.TTFGlyph2D.getGIDForCharacterCode(TTFGlyph2D.java:105)
>     at 
> org.apache.pdfbox.rendering.TTFGlyph2D.getPathForCharacterCode(TTFGlyph2D.java:92)
>     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.renderPage(PDFRenderer.java:208)
>     at 
> org.apache.pdfbox.rendering.PDFRenderer.renderPageToGraphics(PDFRenderer.java:169)
>     at 
> org.apache.pdfbox.printing.PDFPrintable.print(PDFPrintable.java:184)
>     at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:2106)
>     at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1488)
>     at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1331)
>     at ... .printPDF(... .java:63)
>
> I think the problem is that in the readPostScriptNames() where is a 
> chance that the postScriptNames remains null.
>
>         // look up in 'post' table
> -->   readPostScriptNames();
>         Integer gid = postScriptNames.get(name);
>         if (gid != null && gid > 0 && gid < 
> getMaximumProfile().getNumGlyphs())
>         {
>             return gid;
>         }
> *Szirbik, Ferenc*
> ChaRM fejlesztő
> /Euronet Magyarország Zrt./
> 1138 Budapest, Váci út 188.
> Mobil: +36 20 778 2839
> E-mail:szirbik.ferenc@euronetrt.hu <mailto:szirbik.ferenc@euronetrt.hu>
>
> http://www.euronetrt.hu <http://www.euronetrt.hu/>       http://www.charm.hu <http://www.charm.hu/>

Mime
View raw message