Skip to main content
Participant
December 1, 2022
Question

Automatically click a button in pdf file with Acro-js

  • December 1, 2022
  • 3 replies
  • 1195 views
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 has been closed for replies.

3 replies

Thom Parker
Community Expert
Community Expert
December 1, 2022

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.

 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
December 5, 2022

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

 

Bernd Alheit
Community Expert
Community Expert
December 1, 2022

What actions does you use at the button?

try67
Community Expert
Community Expert
December 1, 2022

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.