Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Resize all artboards on all open documents?

Advocate ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

IS there a script to resize the artboard on all open documents? I have hundreds of files that are the same dimensions 14 x 7.5in. I've seen a few scripts that will resize artboards and Art i just want the artboard alone to be changed they also change the size in one direction instead of H x W. Or at the very least is there a script that will resize the artboard per selected document. it would still take a while to do however no where near as long as it would take to manually change the sizes.

 

TOPICS
Scripting

Views

235

Likes

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

correct answers 1 Correct answer

Advocate , Dec 02, 2020 Dec 02, 2020
This should resize around the centre of the artboard (as opposed to the left top corner in the above snippet). var w = prompt("width (in inches)") * 72; var h = prompt("height (in inche)") * 72; var docs = app.documents; for (var i = 0; i < docs.length; i++) { docs[i].activate(); for (var j = 0; j < activeDocument.artboards.length; j++) { var AB = activeDocument.artboards[j]; var xCentre = AB.artboardRect[0] + ((AB.artboardRect[2]-AB.artboardRect[0])/2); var yCentre = AB.artboard...

Likes

Translate

Translate
Advocate ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

I don't know how this will perform with hundreds of documents/artboards, but here you go.

var w = prompt("width (in inches)") * 72;
var h = prompt("height (in inche)") * 72;
var docs = app.documents;
for (var i = 0; i < docs.length; i++) {
  docs[i].activate();
  for (var j = 0; j < activeDocument.artboards.length; j++) {
    var AB = activeDocument.artboards[j];
    AB.artboardRect = [AB.artboardRect[0], AB.artboardRect[1], AB.artboardRect[0] + w, AB.artboardRect[1] - h];
  }
}

Likes

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
Advocate ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

Thank you. This works great except for one thing. What do i have to add to make it adjust all corners evenly  rather than just adjusting the Left and Bottom up? this way my art and text stays centered in the document and i wont have to move anything. I've changed the artboardRect to several different numbers but its not doing what i was hoping.

Likes

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
Advocate ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

This should resize around the centre of the artboard (as opposed to the left top corner in the above snippet).

 

var w = prompt("width (in inches)") * 72;
var h = prompt("height (in inche)") * 72;
var docs = app.documents;
for (var i = 0; i < docs.length; i++) {
  docs[i].activate();
  for (var j = 0; j < activeDocument.artboards.length; j++) {
    var AB = activeDocument.artboards[j];
    var xCentre = AB.artboardRect[0] + ((AB.artboardRect[2]-AB.artboardRect[0])/2);
    var yCentre = AB.artboardRect[1] + ((AB.artboardRect[3]-AB.artboardRect[1])/2);
    AB.artboardRect = [xCentre - w/2, yCentre + h/2, xCentre + w/2, yCentre - h/2];
  }
}

 

Likes

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
Advocate ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

LATEST

Thank you very much works perfect!!!!

Likes

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