Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I execute a JavaScript code (Acrobat JavaScript) when the PDF document is opened in the viewer?

0
Posted

How can I execute a JavaScript code (Acrobat JavaScript) when the PDF document is opened in the viewer?

0

You can use the Document.OpenAction.Action property to set a PdfActionJavaScript object representing the JavaScript code you want to execute when the PDF document is opened in the viewer. For example you can use the code below to display an alert message when the document is opened: document.OpenAction.Action = new PdfActionJavaScript(“app.alert(‘Hello’);”); The document object is either the Document instance created by your application when using the PDF Creator product or a Document object produced by the HTML to PDF library when using a method like PdfConverter.GetPdfDocumentObjectFromUrl().

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123