1 Reply Latest reply on Mar 2, 2014 5:28 AM by try67

    Hide one layer, and remove the visible layers using preflights!

    Johanet

      Hello,

      I have one pdf (with one layer called "ARTWORK")  in which I create a layer using Javascript. To do this I create a watermark and asigning it to a OCG contents with this code:

       

      this.addWatermarkFromText("watermark");

      this.getOCGs();

       

      function FindOCG(cName) {

          var aOCGs = this.getOCGs();

          for(var i=0; aOCGs && i<aOCGs.length;i++) {

              if(aOCGs[i].name == cName) return aOCGs[i];

          }

          return null;

      }

      var ocg = null;

      while( (ocg = FindOCG("Watermark")) != null) ocg.name = "NEW LAYER";

       

      this.setOCGOrder(this.getOCGs());

       

      Then I successfully run a preflight profile, which is able to select an object filled with a defined spot colour and put it on the layer named "NEW LAYER"

       

      The result of this is that I have two layers, (ARTWORK and NEW LAYER)

      But when I want to view ONLY the contents of the NEW LAYER, it is necessary to  show the ARTWORK layer as well, otherwise I see the only the text "watermark" added in the Javascript.

       

      My intention is hide the ARTWORK layer and show only the elements that I moved to the NEW LAYER, running the following Javascript code:

       

      var ocgs = this.getOCGs();

       

      for (var i in ocgs) {

       

          if (ocgs[i].name=="NEW LAYER")

       

              ocgs[i].state = true;

       

      else ocgs[i].state = false;

      }

       

      and then run another preflight to remove invisible layers.

       

      But it seems  that even that I move the elements to the new layer, somehow they still remain in the artwork layer...

       

      Anyone could help me to solve this, please?

       

      Thanks and Regards.