With the February 2019 release of Adobe Acrobat DC, the JavaScript variables used in global namespace are marked as constants and cannot be used as variable names in the global namespace in your scripts. However, you can use the variable names in your local namespace.

 

Impacted Acrobat versions

Acrobat DC, Acrobat 2017, and Acrobat DC 2015 (Classic)

Impacted variable names

The following variable names cannot be modified or redefined in the global namespace:

  • color
  • font
  • border
  • style
  • highlight
  • zoomtype
  • cursor
  • trans
  • position
  • scaleWhen
  • scaleHow
  • display
  • permission
  • submitFormUsageRights
  • fileSystem
  • encoding

Sample script examples

Example 1:

If you define the following code in the global namespace, it'll result in an error:

function position()

{

    //Perform some action

}

The error message: TypeError: can't redefine non-configurable property 'color'

 

Example 2:

If the following code is executed in global namespace, it won't work:

var position = 10;

If you try to access position again, it won't be modified to 10; it's still pointing to the original object as used by Acrobat.

 

Example 3:

Use of the same variable in local scope is allowed. The following code works fine:

(It prints hello as output.)

var example = new function() {

    this. position = function () {

        console.println("hello");

    };

}

example.color();



Example 4:

The following code modifies the value of the variable position to 10, as it is defined in local scope.

function example()

{

   var position= 10;

    console.println(position);

}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy