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

Way in C# to mirror ArtBoard

Explorer ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

I have a need to mirror the Artboard, but I haven't been able to find a way to do this with C# and COM

TOPICS
Scripting , SDK

Views

218

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 ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

What exactly do you mean by 'mirror' the artboard?

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
Explorer ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

From the Menu if you select entire artbaord then Select Object from Menu, then Transform then Reflect horizontal will mirror the entire artboard, Mirroring is a graphics term for making a negative of a drawing ... 

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 ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

The reflection operation with the transform doesn't mirror the artboard, it does whatever object you have selected.

You will need to reference a pageItem (it could be a group with all the items of your document nested inside) and use the 'resize' command. Here is the javascript doc:

SillyV_0-1635904418037.png

 

For C# it is probably:
pageItem.Resize(-1, 1, true, true, true, true, ...  <-- I am not even sure what the C# COM parameters are for the last 2 arguments as in JavaScript we can simply omit them.

As it were, I myself am doing COM lately with Photoshop and will probably do an Illustrator experiment.
However, my standard experience has just always been to pass a javascript through the Application.DoJavaScript or Application.DoJavaScriptFile methods.
What I really like about it in C# is being able to debug it well.

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
Explorer ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

I'll give that a try and see how it goes ...

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
Explorer ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

Using the following code ...

 

// attempt to mirror object by using Javascript
appAI.ActiveDocument.SelectObjectsOnActiveArtboard();
string myScript = "var selectedObjects = app.activeDocument.selection;" +
"selectedObjects.resize(-1, 1, true, true, true, true);";
appAI.DoJavaScript(myScript);

 

Throws the following exception:

Error 24: selectedObjects.resize is not a function.
Line: 1
-> var selectedObjects = app.activeDocument.selection;selectedObjects.resize(-1, 1, true, true, true, true);

 

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 ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

LATEST

You should have a selection first.

You can select all selectable items in your document by using the command

app.executeMenuCommand("selectall");

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