Skip to content

Instantly share code, notes, and snippets.

@Scotchester
Created October 11, 2018 20:57
Show Gist options
  • Save Scotchester/b2ca1b9cebe23566e3a11a5f43499aa1 to your computer and use it in GitHub Desktop.
Save Scotchester/b2ca1b9cebe23566e3a11a5f43499aa1 to your computer and use it in GitHub Desktop.
An Adobe Illustrator script for resizing the first artboard of a document horizontally, to fit the width of the first item on the artboard, but leaving the artboard height the same
#target illustrator
#targetengine main
var doc = app.activeDocument;
var artboard = doc.artboards[0];
var art = doc.pageItems[0];
var coordinates = art.position;
var desiredW = art.width;
art.position = [ 0, coordinates[1] ];
artboard.artboardRect = [
artboard.artboardRect[0],
artboard.artboardRect[1],
desiredW,
artboard.artboardRect[3]
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment