4 Replies Latest reply on Oct 17, 2012 9:52 AM by gkaiseril

    Is there a limit of characters in the document JavaScripts window?

    chiaratu0

      Hi,
      I have several functions with huge arrays of data linked to a button field. All works fine if everything is declared in the document scripts and if the array is not too big. Once I try to insert a very huge array in the document script I receive the message "text is too large to be displayed in this dialogue". Why is so? Is there a limit of characters in the document script window?

      I am therefore trying to set up all arrays and functions in a separate javascript file and then embedded it into the 3d annotation. But when I do so,I loose the link to the button field action.

      As an example I have embedded in the 3d annotation:

       

      global.X= [[10,20,30,40],[5,15,25,35],[7,17,27,37]];

       

      function Update(n) {

           getAnnots3D(0)[0].activated = true;

           var a = global.X[0][n];

           var b = global.X[1][n];

           var c = global.X[2][n];

           var Mycamera = this.getAnnots3D(0)[0].context3D.scene.cameras.getByIndex(0);

           Mycamera.position.set(a,b,c);

           camera_1.roll = 0;

           }

       

      and then I add in the button field Mouse Up action:

       

      Update(3);

       

      but nothing happens (while if the same script is in the document level script it works). I am probably missing the link between the embedded function and the button field? (either at host/doc/app level..)
      many thanks for the help!

        • 1. Re: Is there a limit of characters in the document JavaScripts window?
          gkaiseril MVP & Adobe Community Professional

          Yes, but it is a limit of the internal editor.

           

          In Acrobat's Preferences you can specify an external text editor. Do not select MS Word or Word Pad as these are word processing editors and may add special formating characters or use "smart tag" that will not work with the JavaScript engine. There are a number of free or inexpensive text editors.

           

          Since it appears you are using Acrobat 3D you might want to ask the question in that forum.

          • 2. Re: Is there a limit of characters in the document JavaScripts window?
            Dave Merchant MVP & Adobe Community Professional

            Your script contexts are messed up.

             

            That script is expecting to be run at the document level because it's collecting a reference to the 3D API (via getAnnots3D). You also have an undeclared variable (camera_1).

             

            If you want it to work as a 3D embedded script (not sure why) then you will need to remove the reference to "getAnnots3D.context3D" from the function, so you'd simply say

             

            var Mycamera = .scene.cameras.getByIndex(0);

             

            There's no point in using the first line of the function to activate the API, as the function wouldn't exist until it was active.

             

            Your button will then need to target the function with a reference, so it'd be getAnnots3D(0)[0].context3D.Update(3); (you will also want to put the activation command on the button's event)

            • 3. Re: Is there a limit of characters in the document JavaScripts window?
              chiaratu0 Level 1

              thanks! it makes perfectly sense now! Having the 3D embedded script is very useful as the length of the data is so immense that it would be necessary to have an external text editor (even though I tried with one, it works finel; but when the same pdf is opened in another pc that doesn't have an external text editor it doesn't work any more.. it seems it's not able to access certain information stored in the 3d embedde file).

              many thanks for the help!

              ps. (I mistyped the camera variable...I meant Mycamera instead of camera_1, thanks for spotting it!)

              • 4. Re: Is there a limit of characters in the document JavaScripts window?
                gkaiseril MVP & Adobe Community Professional

                You should check to see what version of Acrobat and OS is being used by the other user and check to see if there is some JS feature that does not work or works differently on that system.