2017-04-01 5 views
0

下のスクリプトで作成したテキスト枠を、ブリード領域のページ領域外に移動する必要があります。誰かが私の下のスクリプトを調整するのを助けることができるなら、それは素晴らしいでしょう。私はPage HeightとWidthを使って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

をこれを使用することができますmyDocument.documentPreferences.pageHeightを使用する必要があります私の移動stateme内のプロパティnt。これにより、ドキュメントの高さを取得する移動が必要になります。

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

Xを計算するスニペットの次の行を追加し、それは言及しなかったように、正確にフレームがブリードでコーナーにシフト故にシフトする必要がある場合yは...動きパラメータの座標ください..あなたは私が最終的に私に把握することができたBhumiの応答から...これは、あなたの質問に答える希望

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です)。ドキュメントの高さが変わる可能性があることに注意してください。可変であるためにはこれが必要です) –

関連する問題