Align TextFrame to page margins with JS
If i have the above page and a textframe in the center what is the javascript code to align / fit the textframe to the page margins ?


If i have the above page and a textframe in the center what is the javascript code to align / fit the textframe to the page margins ?


Hey!
You can do it like this:
var myPage = app.activeWindow.activePage;
var myMargins = myPage.marginPreferences;
if(app.selection.length){
app.selection[0].geometricBounds = [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];
}else{
myPage.textFrames[0].geometricBounds = [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];
}
HTH
--
tomaxxi
http://indisnip.wordpress.com/
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.