This script is based on the script shrinkABtoFitArt_CS4.jsx by Carlos Canto.
Use this Adobe Illustrator Script Extension to resize the artboard to a user-defined size, then center the artwork on the artboard.
Download the ResizeArtboard.jsx file and copy to Illustrator/Presets/{language}/Scripts/
You will need to relaunch Adobe Illustrator after installing the script.
- Open an Adobe Illustrator file with. The file must contain only one artboard and at least one object on the page
- Select File > Scripts > ResizeArtboard
- Enter a positive integer value at the prompt
- After the script has run, save your file
Before setting up the Batch Action, you will need to make a simple change to the JavaScript Extension code.
- Open the Illustrator/Presets/{language}/Scripts/ResizeArtboard.jsx file in a plain text editor
- Comment out line 27 that reads
var size = Number(Window.prompt("Enter Artboard Size as a positive integer", 32, "Resize Artboard"));
- Un-comment line 32 that reads:
var size = 32
The value you set represents the size (square) of the artboard in pixels.
- Open the Actions palette in Illustrator: Window > Actions
- Create a new Action Set and give it a meaningful name (meaningful to you)
- Create a new Action named Resize Artboard in the set you just created
- Select the action in the palette by clicking on it once
- Find the Action Options menu (the inverted triangle with four horizontal lines in the upper right corner of the Actions palette)
- Select "Insert Menu Item ..." from the Action Options menu
- A dialog with a single entry field will appear. You do not need to manually enter a value. Instead, select File > Scripts > ResizeArtboard. The field will be populated automatically.
- Click "OK" on the dialog
- You can now use this Action in a batch script. For instructions on setting up an Illustrator Batch job, see The Adobe Help Site
- 2013-12-05 - The script was created for a very specific use case: To resize the artboard for vector icons and to center the icon.
- 2013-12-05 - The artboard is assumed to be square.
- 2013-12-05 - The script has not been tested with more than one artboard. It is known to work well with a single artboard.
- 2013-12-05 - In order to center the artwork, the script adds every element to a new group. The items are not un-grouped after they are centered (not yet anyway).