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

How to duplicate an artboard and its entire contents in ExtendScript

Community Expert ,
Jul 16, 2025 Jul 16, 2025

There does not seem to be a method to duplicate an artboard in Illustrator's scripting API. Artboards.add and Document.selectObjectsOnActiveArtboard can do something similar, but the developer needs to worry about whether the PageItem is editable.

 

Alternatively, it could find all PageItem's that are in the appropriate artboard area and duplicate them, but I don't want to do that.

 

I have tried to record the duplication of the artboard in an action, but it is not responding.

 

Is there any way to duplicate the artboard while programmatically specifying the coordinates of the artboard, without worrying about whether the artboard's contents are editable or not?

 

The reason I want to do that is because I want to change the position of the artboard as I wish, which will be generated by the artboard duplication.

TOPICS
Scripting
414
Translate
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

correct answers 1 Correct answer

Community Beginner , Jul 18, 2025 Jul 18, 2025

Altough still you need to check locked layers, selecting Artboard Tool then, copying and pasting behave like "Duplicate Artboards" I supporse.


(function () {
	app.selectTool('Adobe Crop Tool');
	app.copy();
	app.paste();
})();

 

Translate
Adobe
Community Expert ,
Jul 16, 2025 Jul 16, 2025

unless there's a relatively new api method I don't know about, I duplicate artboards the way you described it. I duplicate each item on the artboard

Translate
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
Community Expert ,
Jul 16, 2025 Jul 16, 2025

Thank you for your response. There doesn't seem to be a way, but I will wait and hope that a more elegant way will be raised.

 

That being said, what are some of the factors that could cause a mistake in selecting and duplicating/translating the contents of the PageItems? For example the following, but what are the others?

 

  • PageItem locked
  • PageItem hidden
  • Layer locked
  • Layer visible false
  • Guide locked
  • Guide hidden
  • Whether it is an Opacity Mask
Translate
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
Community Expert ,
Jul 16, 2025 Jul 16, 2025

oh damn, yeah it starts getting complicated quickly. Depending on the requirements, I don't deal with every possible scenario if I don't have to.

 

what if you

1. collect visible/lock info for each item in a layer

    1.2 unlock/unhide all

2. select all

3. copy

4. Paste Remember Layers

5. switch to destination document

6. paste

7. restore visible/lock from saved info

 

guides could be excluded before copying

opacity mask are trouble

 

would that work?

 

Translate
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
Community Expert ,
Jul 17, 2025 Jul 17, 2025

Yes, it would be. My intention was to duplicate the artboards within the same document, but it will mostly be accomplished that way.

 

The `Unlock All` and `Show All` menu commands will select the PageItem that was the target of each, so it's relatively easy to restore.

 

If the script uses a manually reproducible method such as copy/paste, it may be possible to translate the opacity masks.

 

The problem is layers. This is prone to MRAP errors because the script has to check the locked/visible status of all layers one by one.

 

I will wait a little longer and if no direct means of using Duplicate Artboards can be found, I will try to develop based on your means. Because Duplicate Artboards has a `Move Locked and Hidden Artwork with Artboard` option.

Translate
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
Community Beginner ,
Jul 18, 2025 Jul 18, 2025

Altough still you need to check locked layers, selecting Artboard Tool then, copying and pasting behave like "Duplicate Artboards" I supporse.


(function () {
	app.selectTool('Adobe Crop Tool');
	app.copy();
	app.paste();
})();

 

Translate
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
Community Expert ,
Jul 18, 2025 Jul 18, 2025

Thanks for the idea.

 

Good news:
That way Duplicate Artboards can be reproduced.

 

Bad news:
The lock/visible state of the layers is a concern for the developer, as you said. The lock/hidden state of the guides also needs to be controlled by the developer.

 

It seems I was too overconfident with the `Move Locked and Hidden Artwork with Artboard` setting... I will develop it on my own, based on CarlosCanto-san's and Kawano Shuji-san's approach.

Translate
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
Community Expert ,
Jul 19, 2025 Jul 19, 2025
LATEST

I submitted to UserVoice the Duplicate Artboards problem that motivated me to develop the script. Feel free to vote for it.

Translate
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