2017-04-01 55 views
0

我需要將在下面的腳本中創建的文本框移到頁面區域外的出血區域。如果任何人都可以幫助我調整下面的腳本,那就太好了。我一直試圖確定如何使用頁面高度和寬度進行X,Y調整,一旦確定。將文本框外頁移動出血

請參閱下面的代碼。任何和所有的幫助將不勝感激,並提前感謝你。

myDocument = app.activeDocument; 
//The bleed and slug properties belong to the documentPreferences object. 
with (myDocument.documentPreferences) { 
//Bleed 
documentBleedBottomOffset = "2in"; 
documentBleedTopOffset = "2in"; 
documentBleedInsideOrLeftOffset = "2in"; 
documentBleedOutsideOrRightOffset = "2in"; 
//Slug 
slugBottomOffset = "0p"; 
slugTopOffset = "0p"; 
slugInsideOrLeftOffset = "0p"; 
slugRightOrOutsideOffset = "0p"; 
} 
var myDocument = app.documents.item(0); 
var myPage = myDocument.pages.item(0); 
var myTextFrame = myPage.textFrames.add(); 
//Set the bounds of the text frame [x1, y1, x2, y2] 
//The x1, y1 refers to the upper left coordinate position; the x2, y2 refers to the lower right coordinate 
//x2 = Height and y2 = Width 
myTextFrame.geometricBounds = [0, 0, .52, 5.5]; 
//Enter text in the text frame. 
//("\r" is a return character.+ 
myTextFrame.contents = "FName Name//12345-6789//\r WxL//\r XXX-YYYYY//W x L-LtrRD//P_"; 
myTextFrame.parentStory.insertionPoints.item(-1).contents = SpecialCharacters.autoPageNumber; 
//Note that you could also use a properties record to 
//create the frame and set its bounds and contents in one line: 
//var myTextFrame = myDocument.pages.item(0).textFrames.add({geometricBounds:[72, 72, 288, 288], contents:"This is some example text."}); 

//Absolute move: based on [X , Y] its important to keep in mind that all units are based on your document units 
myTextFrame.move([1, 5.5]); 

回答

0

從Bhumi的迴應,我終於能夠找出在我應該使用myDocument.documentPreferences.pageHeight在我的移動狀態內的財產NT。這將需要移動來獲得文檔的高度。

myTextFrame.move([-1.5161, myDocument.documentPreferences.pageHeight + .72]); 
0

請添加片段的以下行,將計算x和y座標爲移動參數...由於它沒有提到完全幀需要被移位,因此在排出在角落移動,其中..你可以用它來進行相應的調整..

var theBounds = myPage.bounds; 
var theXCoord = theBounds[3] + (myDocument.documentPreferences.documentBleedBottomOffset)/2; 
var theYCoord = theBounds[2] + (myDocument.documentPreferences.documentBleedBottomOffset)/2; 

myTextFrame.move([theXCoord, theYCoord]); 

希望這回答你的問題......

+0

在上述操作中,它將框放置在文檔的右下角。我想將該框放置在X = -1.5161 X =(這將在文檔頁面下方爲.72)。請記住,文檔高度可能會改變,所以我需要這個可以變化) –