document.JavaScript.Keys throws null referrence exception on access

Using the Aspose.PDF for .NET 4.0 library (latest version 18.2 from 2/13) in a console application.
I’m trying to detect JavaScript embedded in PDFs.
This code throws an exception on every PDF I scan (with or without JavaScript)

Document document = new Document(pathToFile);
document.JavaScript?.Keys?.Count <-- The Keys property throws a null reference exception always on the get.

First that seems like a bug / exception that shouldn’t be happening and second - is there a better way of detecting JavaScript in PDFs?

@johnsmith111155

Thank you contacting support.

I would like to request you to elaborate your requirements please. If you are trying to read all JavaScript present in a PDF file, then a feature request with ID PDFNET-38836 is already logged in our issue management system. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

However, if you want to add JavaScript to a PDF file, or if you want to remove all JavaScript from the PDF file, then it can be done with Aspose.PDF for .NET 18.2. Please mention your requirements so that we may guide you accordingly.

Oh sure - I’m just trying to make a determination of whether a PDF has any JavaScript in it that could run in like an action (OpenAction etc.) or in response to like a click event or something.

Basically I’d love to know whether there’s any embedded JavaScript in a given PDF.

@johnsmith111155

Thank you for elaborating it further.

I am afraid that the requested feature is not currently available in Aspose.PDF API. However, the feature request PDFNET-38836 has been logged in our issue management system. We will notify you as soon as the feature will be supported.

Still nothing?
I am running into the exact same error with Aspose.Pdf .NET 20.05.

Another question is: Why is an error handled as a feature request? I don’t get it.

@bruegmann

The earlier logged ticket is not yet resolved as it requires more time to get properly investigated and implemented to the API.

We have been working over implementing JavaScript related features to the API and the requirements mentioned in this thread are part of those features. Since all the features related to JavaScript handling have not been implemented yet, the ticket was logged as new feature request. We will surely inform you as soon as it is implemented and available. Please spare us some time.

We are sorry for the inconvenience.