Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Automatically click a button in pdf file with Acro-js

New Here ,
Dec 01, 2022 Dec 01, 2022
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?

TOPICS
Acrobat SDK and JavaScript
991
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 2022

What actions does you use at the button?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2022 Dec 05, 2022
LATEST

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines