javascript - Create a GraphicLine using InDesign JS based on Page Size withn the Geometric Bounds -


my overall goal create crop marks specific specifications. have tried manipulating supplied sample script comes indesign no ends. trying create own crop marks , working understand geometric aspects of using graphicline feature.

below have far:

var mycropmarklength = 15.12; var mycropmarkoffset = 20.88; var mycropmarkwidth = .25; var myx1 = ([mydocument.documentpreferences.pageheight - mydocument.documentpreferences.pageheight]); var myy1 = ([mydocument.documentpreferences.pagewidth - mydocument.documentpreferences.pagewidth]); var myx2 = ([mydocument.documentpreferences.pageheight]); var myy2 = ([mydocument.documentpreferences.pagewidth]); myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myx1, myy1, myx2, myy2 ]; myoutsideguide_left.strokeweight = mycropmarkwidth; 

if me able fill in myx1, myy1, myx2, myy2 wonderful. sure missing something, should able reference page size within coordinates how coordinates determined.

best, john

i didn't want use cropmarks.jsx script because require me create rectangle each time work on document. trying build script can applied art files on regular basis , shared team internally. allow consistency across of artwork, crop mark length, offset amount, , stroke weight. want crop marks based on page height , width.

i have been able develop crop marks using below script.

mydocument = app.activedocument;  //change unit of meausre points mydocument.viewpreferences.horizontalmeasurementunits = measurementunits.points; mydocument.viewpreferences.verticalmeasurementunits = measurementunits.points; var mycropmarklength = 15.12; var mycropmarkoffset = 20.88; var mycropmarkwidth = .25; var myph = mydocument.documentpreferences.pageheight; var mypw = mydocument.documentpreferences.pagewidth;  //upper left crop mark pair myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph - myph, (mypw - mypw) - mycropmarkoffset, myph - myph, (mypw - mypw) - (mycropmarkoffset + mycropmarklength) ]; myoutsideguide_left.strokeweight = mycropmarkwidth;  myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [(myph - myph) - mycropmarkoffset, mypw - mypw, (myph - myph)  - (mycropmarkoffset + mycropmarklength), mypw - mypw]; myoutsideguide_left.strokeweight = mycropmarkwidth;  //lower left crop mark pair myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph, (mypw - mypw) - mycropmarkoffset, myph, (mypw - mypw) - (mycropmarkoffset + mycropmarklength) ]; myoutsideguide_left.strokeweight = mycropmarkwidth;  myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph + mycropmarkoffset, mypw - mypw, myph + (mycropmarkoffset + mycropmarklength), mypw - mypw]; myoutsideguide_left.strokeweight = mycropmarkwidth;  //upper right crop mark pair myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph - myph, mypw + mycropmarkoffset, myph - myph, mypw + (mycropmarkoffset + mycropmarklength) ]; myoutsideguide_left.strokeweight = mycropmarkwidth;  myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [(myph - myph ) - mycropmarkoffset, mypw, (myph - myph) - (mycropmarkoffset + mycropmarklength), mypw]; myoutsideguide_left.strokeweight = mycropmarkwidth;  //lower right crop mark pair myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph, mypw + mycropmarkoffset, myph, mypw + (mycropmarkoffset + mycropmarklength) ]; myoutsideguide_left.strokeweight = mycropmarkwidth;  myoutsideguide_left = app.activedocument.pages[0].graphiclines.add (); myoutsideguide_left.geometricbounds = [myph + mycropmarkoffset, mypw, myph + (mycropmarkoffset + mycropmarklength), mypw]; myoutsideguide_left.strokeweight = mycropmarkwidth;  //change unit of measure inches mydocument.viewpreferences.horizontalmeasurementunits = measurementunits.inches; mydocument.viewpreferences.verticalmeasurementunits = measurementunits.inches; 

one of largest issues when creating script determine bounds [y1,x1,y2,x2] backwards thought have been.

hope code helps others in creating crop marks based on page size, cannot use indesign crop mark method based on workflows being used.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -