Thanks for your inquiry. You can easily add JavaScript to you PDF document using Aspose.Pdf for Java. Please check following documentation link for details and code snippet. Hopefully it will help you to accomplish the task.
Yes I’ve seen this mentioning of adding javascript to a pdf document, but is there a way to add a javascript at the page level, i.e. a different script on each page such that it will get executed when a page is viewed?
Thanks for your feedback. You can set page open/close action as well. Please check following code snippet for the purpose. Hopefully it will help you to accomplish the task.
Thanks for the info. We’re testing Aspose Cloud right now while setting up a server for Aspose.java. is it possible for us to test what you’ve suggested through the Aspose Cloud REST API?
Thanks for your feedback. I am afraid currently the subjected feature is not available in Aspose Cloud. However, we have a logged a new feature request, SAASPDF-122, in our issue tracking system for further investigation and implementation. We will notify you as soon as it is implemented.
Thanks for your query. You can use setBeforeClosing() property from Action collection of Document as following. Hopefully it will help you to accomplish the task.
doc.getActions().setBeforeClosing()
Please feel free to contact us for any further assistance.
We have tested your scenario in our environment, and it is working fine. This is the output PDF: JavaScript-Added.pdf (1.6 KB). If this does not help, then please send us your source PDF and code. We will investigate your scenario in our environment, and share our findings with you.