5 Replies Latest reply on Dec 8, 2016 12:17 AM by den.engenius

    Adobe Acrobat crashes when changing OCG (Layer) properties via javascript

    den.engenius Level 1

      I work with quite a few layers (aka OCGs / optional content groups) in order to have multiple locales within the same document. I wrote a few scripts that help to lock layers (so they cannot be made visible from within the UI), and to show or hide layers (based on a pattern matching of their name). These functions basically loop through all layers and conditionally chage the locked, state or initState properties is this kind of way:

      • this.getOCGs()[i].locked = true;
      • this.getOCGs()[i].state = isVisible;
      • this.getOCGs()[i].initState = isVisible;

      Now, at about 40 to 50 layer property manipulations (no matter if the same layer or different layers), Acrobat simply crashes. These crashes were consistantly reproducable on any version since Acrobat X (Reader and Pro), both on Mac and Windows (whereas the Windows Version seems to allow a few more manipulations).


      Is there any known workarround? If not, how can we paying customers make Adobe fix this as quickly as possible?





      Update: acutally, not just property manimullation causes the issue. Simple read-access already leads to the crashes. Create a PDF with some 50-60 layers and run the following code:

      for (i=0; i<this.getOCGs().length; i++) {

        var showLayer = false;

        for (var x = 0; x < 6; x++) // increase the loop count if you have less than 50 layers / OCGs


          var layerState = this.getOCGs()[i].state;

          console.println("Layer #"+i+", state=["+layerState+"], loop #" +x);