2 Replies Latest reply on Jul 14, 2014 9:26 PM by MatLac

    Initializing a variable at docOpen

    MatLac Level 3

      My form needs to create an array, sort it and put it in a variable that might need to be used anywhere on the form.  I want this variable to be initialized upon opening the document.  Is there a way to make a variable global from a docOpen() function for example?

        • 1. Re: Initializing a variable at docOpen
          gkaiseril MVP & Adobe Community Professional

          There is the document level JavaScripts that can define variables or functions and this code is run upon the opening of the PDF file.


          Entering Document Scripts by Thom Parker.


          Functions entered if need to run during the opening process need to be called.


          Any script outside a function definition will be executed.


          Document level script only run upon opening the document unlike the page open action which runs each time the page is opened.



          Global variables are very different than document variables.


          Global variables have a scope of all open PDFs.



          This is a static JavaScript object that allows you to share data between documents and to have data be persistent across sessions. Such data is called persistent global data. Global data-sharing and notification across documents is done through a subscription mechanism, which allows you to monitor global data variables and report their value changes across documents.

          • 2. Re: Initializing a variable at docOpen
            MatLac Level 3

            More than I expected, thanks