Bob Haslett
Bob Haslett

Reputation: 1103

Scale objects in illustrator using extendscript

I'm trying to scale objects on a page by a set amount using a script. I can highlight the object and set a transformation matrix, but I don't know how to apply it to the highlighted object. The reference manual is pretty slim when it comes to this. This is what I have

var doc = app.activeDocument.activeLayer.pageItems;
doc.hasSelectedArtwork = true;//selects all the items on the page


var m=app.getScaleMatrix(50,60)//set how much I would like to scale
app.redraw()

If anyone could tell me show to scale line weight also that would help

Many thanks Bob

Upvotes: 2

Views: 1958

Answers (1)

Bob Haslett
Bob Haslett

Reputation: 1103

This works if you group the items first, but can/t work out how to ungroup afterward

var doc = app.activeDocument;
var item = doc.pageItems[0];

//doc.hasSelectedArtwork = true;
item.resize(
    50.0, // x
    60.0, // y
    true, // changePositions
    true, // changeFillPatterns
    true, // changeFillGradients
    true, // changeStrokePattern
    );

Upvotes: 3

Related Questions