将页面外的文本框移到出血中

Move Text Frame Outside Page into Bleed

我需要将在下面的脚本中创建的文本框架移动到页面区域之外的出血区域。如果有人能帮我调整下面的脚本,那就太好了。一旦确定,我一直在尝试确定如何使用页面高度和宽度进行 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]);

请添加以下几行代码片段来计算移动参数的 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]);

希望这能回答您的问题...

从 Bhumi 的回复中,我终于明白我应该在移动语句中使用 myDocument.documentPreferences.pageHeight 属性。这将需要移动以获取文档的高度。

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