Skip to main content
Participant
August 20, 2012
Question

loop through layers and determine if its a text containing layer

  • August 20, 2012
  • 1 reply
  • 599 views

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
                    }

                }

This topic has been closed for replies.

1 reply

A. Patterson
Inspiring
August 21, 2012

This is the forum for the C++ SDK -- I think you'd have more luck posting this in the Scripting forum:

http://forums.adobe.com/community/illustrator/illustrator_scripting

Good luck!