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

Free Support Forum - aspose.com

Null Pointer Exception On Password Protecting a PDF

Hello
I am working on Encryption. I am protecting PDF file by the below code .

Document pdfDocument = null;
pdfDocument= new Document(“C:\Users\this\Desktop\Files Images…”);
pdfDocument.encrypt(“pk”, “pk1”, 0, CryptoAlgorithm.AESx128);
pdfDocument.save(“C:\Users\this\Desktop\Files Images\pdf\Feedbac.pdf” );
But got some Exception

Exception in thread “main” java.lang.NullPointerException: Cannot read the array length because local4 is null
at com.aspose.pdf.internal.l0h.ld.lI(Unknown Source)
at com.aspose.pdf.ADocument.encrypt(Unknown Source)
at com.aspose.pdf.Document.encrypt(Unknown Source)
at com.aspose.pdf.ADocument.encrypt(Unknown Source)
at com.aspose.pdf.Document.encrypt(Unknown Source)
So please resolve As soon as possible.

I am attaching the Input file.Feedback Businessplan1.pdf (1.5 MB)

I also check your server but got some error . https://products.aspose.app/pdf/lock

Thanks

@David_jack

I have been able to reproduce the issue with your particular file on our end. A ticket with ID PDFJAVA-40607 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.