Change Page size with a Script

Participant ,
Jun 04, 2013 Jun 04, 2013

Copy link to clipboard

Copied

I have made artwork in Illustrator that is set up as two page spreads on 1 artboard.

I need to convert this to single page spreads.

I.e. So for half the documents, I need to set the anchor point of the document to top left and half the width of the artboard.

For the other half of the documents, I need to set anchor point to to right and half the width.

Is this possible with scripting?

I have look around online to find ways of accessing the document size and anchor point via scripting, but cannot seem to find any resources.

Thanks for any help that can be offered.

Edit: Also is it possible to create a new artboard with a script and assign it a name?

TOPICS
Scripting

Views

1.2K

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

Adobe Community Professional , Jun 05, 2013 Jun 05, 2013
here you go, this script splits the artboard in two// carlos canto// http://forums.adobe.com/message/5380624#5380624var idoc = app.activeDocument;var ab = idoc.artboards[0];var abBounds = ab.artboardRect;// left, top, right, bottomvar ableft = abBounds[0]; // 0var abtop = abBounds[1]; // 612var abright = abBounds[2];var abbottom = abBounds[3];var abwidth = abright - ableft; // 792 // widthvar abheight = abtop- abbottom; // 0 // heightvar half = ableft + abwidth/2;var abright2 = half;ab.artboardR...

Likes

Translate

Translate
Guru ,
Jun 04, 2013 Jun 04, 2013

Copy link to clipboard

Copied

Without a picture of the artwork its a little guesswork… I would suspect that you could change the existing artboard's rectangle or add a new one and remove the old…

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
Participant ,
Jun 04, 2013 Jun 04, 2013

Copy link to clipboard

Copied

Without a picture of the artwork its a little guesswork… I would suspect that you could change the existing artboard's rectangle or add a new one and remove the old…

Thanks for the reply!

I have found you can do this with doc.visibleBounds However, is it possible to create two artboards in one document with a script. E.g. so I can have one artboard for the left side spread and another artboard for the right side?

Thanks!

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
Adobe Community Professional ,
Jun 05, 2013 Jun 05, 2013

Copy link to clipboard

Copied

here you go, this script splits the artboard in two

// carlos canto

// http://forums.adobe.com/message/5380624#5380624

var idoc = app.activeDocument;

var ab = idoc.artboards[0];

var abBounds = ab.artboardRect;// left, top, right, bottom

var ableft = abBounds[0]; // 0

var abtop = abBounds[1]; // 612

var abright = abBounds[2];

var abbottom = abBounds[3];

var abwidth = abright - ableft; // 792 // width

var abheight = abtop- abbottom; // 0 // height

var half = ableft + abwidth/2;

var abright2 = half;

ab.artboardRect = [ableft, abtop, abright2, abbottom];

var ableft2 = half;

var newAB = idoc.artboards.add([ableft2, abtop, abright, abbottom]);

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
Participant ,
Jun 06, 2013 Jun 06, 2013

Copy link to clipboard

Copied

That's excellent, thanks!

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
Community Beginner ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Hi Carlos. I know this is a super old post, but I am using CS5 still 🙂

Could you help with this?

I am getting this error:

"error 21 undefined is not an object.  var ableft = abBounds[0]; // 0"

 

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
Community Beginner ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

LATEST

oops just realized this was the wrong post. going to post on the other one.

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