3 Replies Latest reply on Apr 4, 2017 4:22 PM by davidsonjw

    Move Text Frame Outside Page into Bleed using Javascript

    davidsonjw

      I need to move the text frame created in the below script to outside the page area to the bleed area. If anyone can help me adjust the below script, that would be wonderful. I have been trying to determine how to use Page Height and Width to do an X, Y adjustment once that is determined. 

       

      I was thinking of using a Get Bounds variable, but I have not been able to successfully incorporate it.

       

      Please see my code below. Any and all help would be greatly appreciated and thank you in advance.

       

      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]);