Scripting stroke alignment (JSX)
In the Illustrator JavaScript reference book (2017) there's no documented method of changing the stroke alignment of a pathItem that I can see.
I have a set of dynamically created rounded rectangles in a document which all require a stroke to be aligned to the inside of the path. The only other option I can think of is to calculate a new position by subtracting the stroke width from the pathItem width to get a new position for the pathItem but this seems so fiddly to get right.
There must be a way to set this option via scripting?
Code so far:
var doc = app.activeDocument;
var pageItems = doc.pageItems;
var artLayer = doc.layers.getByName('newFrames');
for(var i = 0; i < pageItems.length; i++)
{
if(pageItems[i].name.match("linkedFrame"))
{
var top = pageItems[i].position[1];
var left = pageItems[i].position[0];
var border = artLayer.pathItems.roundedRectangle
(
top, /* y */
left, /* x */
new UnitValue(527, 'mm').as('pt'),
new UnitValue(127, 'mm').as('pt'),
new UnitValue(10, 'mm').as('pt'),
new UnitValue(10, 'mm').as('pt')
);
var black = new RGBColor();
black.red = 255;
black.green = 0;
black.blue = 0;
border.filled = false;
border.stroked = true;
border.strokeWidth = new UnitValue(2, 'mm').as('pt');
border.strokeColor = black;
}
}
