We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Null pointer on Aspose text extraction

Hi,

Am getting null pointer exception for the below code. It is throwing null pointer only on my machine and not able to extract text from the document. Any suggestions are highly appreciated.

TextExtractionOptions textExtOptions = new TextExtractionOptions(TextExtractionOptions.TextFormattingMode.Pure);

            TextAbsorber textAbsorber = new TextAbsorber();
            textAbsorber.setExtractionOptions(textExtOptions);

            pdfDocument.getPages().get_Item(1).accept(textAbsorber);

I get the following exception

java.lang.NullPointerException: null
at com.aspose.pdf.internal.l13I.I17.ll(Unknown Source)
at com.aspose.pdf.internal.l13I.I17.lIf(Unknown Source)
at com.aspose.pdf.internal.l13I.I1I.lif(Unknown Source)
at com.aspose.pdf.internal.l13I.I1I.lif(Unknown Source)
at com.aspose.pdf.internal.l13I.I1I.lIf(Unknown Source)
at com.aspose.pdf.internal.l13I.I1I.(Unknown Source)
at com.aspose.pdf.internal.l13I.I1I.(Unknown Source)
at com.aspose.pdf.TextAbsorber.visit(Unknown Source)
at com.aspose.pdf.Page.accept(Unknown Source)

@sgangaji

Would you kindly share the sample PDF file for our reference. We will test the scenario in our environment and address it accordingly.

Hi, it is happening with any pdf file not only a specific one. Do we need to set any environment variables?

Any other suggestions are greatly appreciated.

@sgangaji

There is no need to set environment variable. We have tested the scenario with one of our sample files and were unable to notice the exception. Would you please make sure that the PDFs you are trying to process contain text inside them. Please provide us one sample PDF which is creating issue on your side. We will test the scenario in our environment and address it accordingly.