Skip to main content
Participant
July 27, 2021
Answered

Create a button with an icon in script

  • July 27, 2021
  • 1 reply
  • 1430 views

Hello,

I want to create a button and that button should show a page from another pdf document. I have written a folder level script (so no security issues) and the code that I use is this:

var firstButton = newDoc.addField("Button 1", "button", pageNumber, [50, 67, 180, 247]);
firstButton.buttonImportIcon(this.path, pageNumberOfOrigDoc);

The button is created but the icon does not show. Do I need to set another property or something? In the Acrobat interface I need to set the layout to Icon Only but I can't find a similar property to set in the script for this.

 

Thank you for taking your time reading this (and maybe helping out).

This topic has been closed for replies.
Correct answer BarlaeDC

Hi,

 

The firstButton has a buttonPosition which I think is what you are looking for:

 

 

1 reply

BarlaeDC
Community Expert
BarlaeDCCommunity ExpertCorrect answer
Community Expert
July 27, 2021

Hi,

 

The firstButton has a buttonPosition which I think is what you are looking for:

 

 

NysannaAuthor
Participant
July 27, 2021

Yes, thank you! That's not really a logical name for me, that's probably why I didn't find it. It would have been nice if the Acrobat API Reference mentioned this property needed to be set when using buttonImportIcon.