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

Increment button creation placement

Engaged ,
Nov 06, 2018 Nov 06, 2018

I am creating buttons on a page based on if a layer exist or not. Not all layers will be in every document. How do I increment the buttons being created so that they will be stacked and have just a little space between each?

Here is the script I have written with just creating them at the size I need.... but they obviously stack right on top of each other.

var inch = 72;

for (var p = this.numPages - 1; p >= 0; p -= 2) {

    var buttonPlace = this.getPageBox({

        nPage: p

    });

    for (var i = 0; i < ocgArray.length; i++) {

        if (ocgArray.name == "No Color") {

            buttonPlace[2] = 0.5 * inch;

            buttonPlace[0] = buttonPlace[2] + 0.868 * inch;

            buttonPlace[1] = 30 * inch;

            buttonPlace[3] = buttonPlace[1] + 0.11 * inch;

            var f = this.addField(ocgArray.name, "button", p, buttonPlace)

            f.setAction("MouseUp", "noColor();");

        }

        if (ocgArray.name == "Black (Ground)") {

            buttonPlace[2] = 0.5 * inch;

            buttonPlace[0] = buttonPlace[2] + 0.868 * inch;

            buttonPlace[1] = 30 * inch;

            buttonPlace[3] = buttonPlace[1] + 0.11 * inch;

            var f = this.addField(ocgArray.name, "button", p, buttonPlace)

            f.setAction("MouseUp", "ground();");

        }

        if (ocgArray.name == "032 (Red)") {

            buttonPlace[2] = 0.5 * inch;

            buttonPlace[0] = buttonPlace[2] + 0.868 * inch;

            buttonPlace[1] = 30 * inch;

            buttonPlace[3] = buttonPlace[1] + 0.11 * inch;

            var f = this.addField(ocgArray.name, "button", p, buttonPlace)

            f.setAction("MouseUp", "zeroThreeTwo();");

        }

    }

}

TOPICS
Acrobat SDK and JavaScript , Windows
383
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
no replies

Have something to add?

Join the conversation