• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

javascript pageItem interface does not exist in C#

Participant ,
Sep 05, 2017 Sep 05, 2017

Copy link to clipboard

Copied

In javascript, I think that there is an interface called pageItem,
In C#, pageItem is missing.

For pageItems, both javascript and C# exist, but ...
When pageitems is looped with foreach, it is treated as object instead of pageitem.
I want to access the property of pageitem.
What should I do?

Illustrator version is CC2017
.

TOPICS
Scripting

Views

562

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Sep 05, 2017 Sep 05, 2017

Copy link to clipboard

Copied

This is interesting, is there a reference for the C# Illustrator type library?

Are you using VisualStudio to write code and debug the C# in Illustrator?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 05, 2017 Sep 05, 2017

Copy link to clipboard

Copied

I have no reference.
Add the illustrator COM library from the reference setting in visualstudio,
It is running from C#.

What kind of objects are available, I am doing it while checking with intellisense.
So, the pageItem object can not be found,
I do not know whether it is because it does not exist or just not found.

However, when I ask a question on another forum (in Japan)
If you define it as "dynamic", like pageItem
Since I understood that I can get an object,
Once as a content of this question was resolved.

I'm sorry I did a multipost.
I will post the sample resolution code.

var _illuApp = new Illustrator.Application();

var illuDoc = _illuApp.Open(inFilePath, AiDocumentColorSpace.aiDocumentCMYKColor);
var lay = doc.Layers["layer1"];
var subLays = lay.Layers["sublayer1"];

foreach (dynamic pageItem in subLays.PageItems)
{
    var piPos = pageItem.Position;
    var newPos = new object[2];

    newPos[0] = piPos[0] + 2.5;
    newPos[1] = piPos[1] + 3.0;
    pageItem.Position = newPos;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 06, 2017 Sep 06, 2017

Copy link to clipboard

Copied

I would be interested in the output of the "Locals" debug window, it shows the contents of variables, if you look at it while at a breakpoint.

Thank you for posting the solution, as it will surely help anyone else who wants to do C# and use Illustrator as part of a .net application.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 07, 2017 Sep 07, 2017

Copy link to clipboard

Copied

Silly-V

Is this the debug window you want to see?
By the way, the object at this time is a compound path.

pageitem_dynamic.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 07, 2017 Sep 07, 2017

Copy link to clipboard

Copied

LATEST

Nice, looks cool! I can't read the Japanese, but this data browser appears to be showing all the objects just like the one in ESTK for javascript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines