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

Not managing to set x,y coordinates of a form element...

Participant ,
Apr 06, 2018 Apr 06, 2018

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!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

238

Translate

Translate

Report

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 ,
Apr 06, 2018 Apr 06, 2018

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.

Votes

Translate

Translate

Report

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 ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

Use the property "rect". Details are in the Acrobat JavaScript Reference.

Votes

Translate

Translate

Report

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
Participant ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

LATEST

Thank you guys!

Votes

Translate

Translate

Report

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