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

Free Support Forum - aspose.com

Aspose.PDF JavaScript throws NullObjectReference when trying to find whether the PDF contains javascript

When I use the Javascript Collection and try throws NullObjectReference when trying to find whether the PDF contains javascript:

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(inStream);

JavaScriptCollection javascript = pdfDocument.JavaScript;

      if (javascript == null)
               hasJavascript = false; 

It throws the Object null reference error:
{System.Collections.Generic.Dictionary2+ValueCollection[System.String,#=zT8W1SvLcfyjKy4R9Lm61eRRqwpltG2zbDQ==]} " at Aspose.Pdf.JavaScriptCollection.#=zLQAefWHRKy68(#=zBAxJlleIr5pNqZ7Vr4Tron3UFrvWWDoIFQ== #=zJDcxkC8=, List1 #=z6K6xFRA=)\r\n
at Aspose.Pdf.JavaScriptCollection.get_Keys()"

@chentc94

Would you kindly share the sample PDF with us. We will test the scenario in our environment and address it accordingly.