Drawing a Line in InDesign CS5.5 using ExtendScript -
i know how draw line on indesign using extended script like
pseudo code
for(x = 0; x < 5; x++){ drawline(the x value startline, y-value startline, length, color); }
any appreciated.
thank you
try script. https://github.com/fabiantheblind/extendscript/wiki/graphic-lines.
var data = { "pw":100, "ph":100, "anchors":[ [ 0,50], [ 10,60], [ 20,40], [ 30,60], [ 40,40], [ 50,60], [ 60,40], [ 70,60], [ 80,40], [ 90,60], [100,50] ] }; // need doc. // use pw , ph data. var doc = app.documents.add({ documentpreferences:{ pageheight:data.ph, pagewidth:data.pw } }); // page there. var page = doc.pages.item(0); // create graphicline. var gl = page.graphiclines.add(); // loop through data.anchors. for(var in data.anchors){ var point = gl.paths[0].pathpoints[i]; /** * graphicline has 2 path points * need add points third * anchor data object */ if(i < 2){ point.anchor = data.anchors[i]; }else{ point = gl.paths[0].pathpoints.add(); point.anchor = data.anchors[i]; } if((i != data.anchors.length - 1)&& i!=0) point.rightdirection = data.anchors[i-1]; point.leftdirection = data.anchors[i]; }
Comments
Post a Comment