Free Support Forum - aspose.com

NullPointerException when creating com.aspose.pdf.Document object from PDF with digital signature

When creating a com.aspose.pdf.Document object passing an InputStream of a signed PDF we get a NullPointerException.

The code:

            ......
	InputStream binaryInputStream;
	try {
		binaryInputStream = input.asInputStream(getCharset());
	} catch (IOException e1) {
		throw new PipeRunException(this,
					getLogPrefix(session) + "cannot encode message using charset [" + 
                                            getCharset() + "]", e1);
	}

	try {
		Document doc = new Document(binaryInputStream);
            .....

The output:

Caused by: java.lang.NullPointerException
at com.aspose.pdf.internal.l8f.l0v.l0h(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l8f.l0v.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l8f.l0v.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l6t.lf.lI(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l8f.l0t.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l6t.lf.lb(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l0k.l0if.lf(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.internal.l0k.l0if.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.ADocument.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.ADocument.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at com.aspose.pdf.Document.(Unknown Source) ~[aspose-pdf-19.1.jar:19.1]
at nl.nn.adapterframework.extensions.aspose.pipe.AmountOfPagesPipe.doPipe(AmountOfPagesPipe.java:60) ~[classes/:?]

Using Aspose.PDF versie 19.1 for Java.
Java version = 1.8.0_231

Request your help in solving this.

@sojourn999

Would you please also share your sample PDF with us as well. We will test the scenario in our environment and address it accordingly.