Home > Net >  Get stroke color from Adobe Illustrator vector object
Get stroke color from Adobe Illustrator vector object

Time:12-29

I am trying to get the stroke color of an Adobe Illustrator vector object using COM.Interop.Illustrator.

The code is fairly simple, just an iteration through objects:

        for (int i = 1; i < openedIllu.PathItems.Count 1; i  )
        {
            if(openedIllu.PathItems[i].Stroked){
                Console.WriteLine(openedIllu.PathItems[i].StrokeColor);
            }
        }

The object's stroke has a spot color asigned but the color type doesn't matter, the beahaviour is the same. The output is System.__ComObject. The StrokeColor doesn't have any properties.

I tried to assign a color using the same property (openedIllu.PathItems[i].StrokeColor = "Black";) and this happend:

System.PlatformNotSupportedException: 'Operation is not supported on this platform.

Can anyone help, please?

CodePudding user response:

Found it; It's like scratching your butt trough the ear:

            SpotColor color = new SpotColor();

            for (int i = 1; i < openedIllu.PathItems.Count 1; i  )
            {
                if (openedIllu.PathItems[i].Stroked)
                {
                    color = openedIllu.PathItems[i].StrokeColor;
                    Console.WriteLine($"sColor = {color.Spot.Name}");
                }
            }
  • Related