Previous Next


                                                    709
       SECTION 8.6                                                               Interactive Forms



       JavaScript Actions

       A JavaScript action (PDF 1.3) causes a script to be compiled and executed by the
       JavaScript interpreter. Depending on the nature of the script, various interactive
       form fields in the document may update their values or change their visual ap-
       pearances. Netscape Communications Corporation’s Client-Side JavaScript Refer-
       ence and the Adobe JavaScript for Acrobat API Reference (see the Bibliography)
       give details on the contents and effects of JavaScript scripts. Table 8.90 shows the
       action dictionary entries specific to this type of action.

                       TABLE 8.90 Additional entries specific to a JavaScript action
KEY   TYPE                   VALUE

S     name                   (Required) The type of action that this dictionary describes; must be JavaScript
                             for a JavaScript action.

JS    text string or         (Required) A text string or text stream containing the JavaScript script to be exe-
      text stream            cuted.
                             Note: PDFDocEncoding or Unicode encoding (the latter identified by the Unicode
                             prefix U+ FEFF) is used to encode the contents of the string or stream. (See imple-
                             mentation note 126 in Appendix H.)

       To support the use of parameterized function calls in JavaScript scripts, the
       JavaScript entry in a PDF document’s name dictionary (see Section 3.6.3, “Name
       Dictionary”) can contain a name tree that maps name strings to document-level
       JavaScript actions. When the document is opened, all of the actions in this name
       tree are executed, defining JavaScript functions for use by other scripts in the
       document.

       Note: The name strings associated with individual JavaScript actions in the name
       dictionary serve merely as a convenient means for organizing and packaging scripts.
       The names are arbitrary and need not bear any relation to the JavaScript name
       space.

Previous Next