NullPointerException in SimpleFont.onLoad

Anonymous
2011-03-02
2013-01-26

  • Anonymous
    2011-03-02

    Hi Stefano,

    I keep getting the following Null pointer exception when I try to parse certain PDF's. Is this a bug in the package ?

    Exception in thread "main" java.lang.NullPointerException
            at java.util.Hashtable.put(Unknown Source)

            at org.pdfclown.documents.contents.fonts.SimpleFont.onLoad(SimpleFont.java:141)
            at org.pdfclown.documents.contents.fonts.Font.load(Font.java:723)
            at org.pdfclown.documents.contents.fonts.Font.<init>(Font.java:343)
            at org.pdfclown.documents.contents.fonts.SimpleFont.<init>(SimpleFont.java:62)
            at org.pdfclown.documents.contents.fonts.TrueTypeFont.<init>(TrueTypeFont.java:69)
            at org.pdfclown.documents.contents.fonts.Font.wrap(Font.java:249)
            at org.pdfclown.documents.contents.FontResources.wrap(FontResources.java:81)
            at org.pdfclown.documents.contents.FontResources.wrap(FontResources.java:42)
            at org.pdfclown.documents.contents.ResourceItems.get(ResourceItems.java:114)
            at org.pdfclown.documents.contents.objects.SetFont.scan(SetFont.java:107)
            at org.pdfclown.documents.contents.ContentScanner.moveNext(ContentScanner.java:1237)
            at org.pdfclown.documents.contents.ContentScanner$TextWrapper.extract(ContentScanner.java:773)
            at org.pdfclown.documents.contents.ContentScanner$TextWrapper.<init>(ContentScanner.java:739)
            at org.pdfclown.documents.contents.ContentScanner$TextWrapper.<init>(ContentScanner.java:727)
            at org.pdfclown.documents.contents.ContentScanner$GraphicsObjectWrapper.get(ContentScanner.java:652)

            at org.pdfclown.documents.contents.ContentScanner$GraphicsObjectWrapper.access$500(ContentScanner.java:641)
            at org.pdfclown.documents.contents.ContentScanner.getCurrentWrapper(ContentScanner.java:1061)

            at org.pdfclown.tools.TextExtractor.extract(TextExtractor.java:463)
            at org.pdfclown.tools.TextExtractor.extract(TextExtractor.java:470)
            at org.pdfclown.tools.TextExtractor.extract(TextExtractor.java:225)
            at PDFExtract.run(PDFExtract.java:66)

    Thanks,
    Aishwarya

     
  • Hi Aishwarya,

    please send one of your PDF samples (in case you have no privacy concerns) to my private email so I can get it a try; otherwise, due to the wild variability of file contents, it's really hard to figure out the cause of your issue.

    Thank you
    Stefano

     
  • PS: please open new threads about the use of the library (such as this one) in the Help Forum, NOT the Open Discussion Forum (which is about the development of the library).