7 Replies Latest reply on Aug 22, 2012 8:04 AM by Muppet Mark

    loop through layers and determine if its a text containing layer

    Kucuk87

      Hi,

       

      I am trying to loop/iterate through all layers, determine if it's a "text-layer", if it is, set it's opacity to 0.

       

      This is what I have so far:

       

      var iapp = new Illustrator.Application();

      var openoptions = new Illustrator.OpenOptions();

       

      var idoc = iapp.Open("c:\\myFile.pdf", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, openoptions);

       

      Illustrator.Layer mainlayer = idoc.Layers["Layer 1"];

       

      foreach (Illustrator.GroupItem groupitem in idoc.GroupItems)
      {
      foreach (Illustrator.GroupItem item in groupitem.GroupItems)
      {
      /* determine here if its a textlayer */
      if( ... ) // (item.TextFrames.Count > 0) perhaps?
      {
      item.Opacity = 0;
      }

      //item.Opacity = 15; //this indeed sets the layer opacity 15
      }

      }