Copy link to clipboard
Copied
I have a PDF with an intro tutorial compounded by 5 small custom popups distributed on separate layers. The popups has a close button. As a popup is closed the next one is shown and so on. Because I use the very same close button for all the popups (and the poppus will show up in different places on the screen) I have to move the close button accordingly. However I am no managing to do this...
I tried:
this.getField("btnClose").style.left = "7.82in";
this.getField("btnClose").style.bottom = "7.47in";
this.getField("btnClose").style.right = "8.04in";
this.getField("btnClose").style.top = "7.69in";
But then it caused a sintaxe error (I think it didn't like the 'style' property). Then I tried:
this.getField("btnClose").left = "7.82in";
this.getField("btnClose").bottom = "7.47in";
this.getField("btnClose").right = "8.04in";
this.getField("btnClose").top = "7.69in";
As you may noticed I remove the 'style' so it didn't raise the error but also didn't move my button.
PS: I tried to use "px" instead "in" but it didn't produce any effect (the button still doesn't move)
I am using Acrobat XI.
Any idea?
Thanks!
Copy link to clipboard
Copied
You can't develop code by guessing. It's not going to work. You have to study the relevant API Reference and look for working code samples to do it correctly.
To set the location of a field you must set its rect property, which is:
An array of four numbers in rotated user space that specify the size and placement of the form field. These
four numbers are the coordinates of the bounding rectangle and are listed in the following order:
upper-left x, upper-left y, lower-right x and lower-right y.
The units used are PostScript Points, of course.
Copy link to clipboard
Copied
Use the property "rect". Details are in the Acrobat JavaScript Reference.
Copy link to clipboard
Copied
Thank you guys!