Skip to main content
Participant
Dec 1, 2022 10:58 AM UTC
Question

Automatically click a button in pdf file with Acro-js

I am very new to javascript in pdf files. I have a pdf file with a button and I would like to have it clicked automatically or when the page with it is loaded or after a certain delay.

I know these procedures exist in Javascript, but I did not find them in Acro-js. I cannot use methods other than Javascript. How can I do it?

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Thom Parker
Community Expert
Community Expert
Dec 1, 2022 5:50 PM UTC

If the button does not run JavaScript, but runs some other Action instead, then a bookmark can be used as a proxy. There is no functionality in Acrobat JavaScript for forcing a button click, but there is for a bookmark click. Put the button action on a bookmark, then add JavaScript code to the Page Open script to run the bookmark after a delay.

 

 

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Dec 5, 2022 1:02 PM UTC

Thank you to all of you. I tried to place the action in a function as suggested and it worked.

 

Translate
Bernd Alheit
Community Expert
Community Expert
Dec 1, 2022 11:06 AM UTC

What actions does you use at the button?

Translate
try67
Community Expert
Community Expert
Dec 1, 2022 11:05 AM UTC

It's not possible to "emulate" clicking a button using Acro JS. However, if the action associated with the button is to execute a script, you can place that code in a function at the doc-level and then just call it directly.

Translate