ExtendScript – Illustrator : Change artboard size

How to change artboard size with ExtendScript in Illustrator

//change artboard size.
function changeCurrentArtboardSize(size){
    alert(“changing artboard size”);
    activeDocument.artboards.setActiveArtboardIndex(2);//change which artboard you want to crop
    var newWidth = new UnitValue (size[0], “px”);
    var newHeight = new UnitValue (size[1], “px”);
    newWidth = newWidth.as(“px”);
    newHeight = -newHeight.as(“px”);//as px not needed but i’ll keep it in case i want to reference later.
    activeDocument.artboards[0].artboardRect = [0,0,newWidth,newHeight];
//end function

Adobe illustrator scripting

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s