• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Move Text Frame Outside Page into Bleed using Javascript

Explorer ,
Apr 02, 2017 Apr 02, 2017

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

771

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Apr 04, 2017 Apr 04, 2017

I was finally able to figure out that I should use the myDocument.documentPreferences.pageHeight property within my move statement. This will require the move to get the height of the document.

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

Votes

Translate

Translate
Engaged ,
Apr 03, 2017 Apr 03, 2017

Copy link to clipboard

Copied

Hi ,

Try this code:

var myDoc = app.documents[0];

with(myDoc.documentPreferences)

{

documentBleedUniformSize = true;

documentBleedTopOffset = "3p";

}

var myPage = myDoc.pages.item(0);

var myTextFrame = myPage.textFrames.add();

myTextFrame.geometricBounds = ["4p", "3p","58p" , "25p"];

// Use Y1, X1, Y2, X2

myTextFrame.contents = "pages\rtextFrame\rgeometricBounds";

var newPosition = ["-1.5in"," 0in"];

myTextFrame.move(newPosition)

alert("TextFrame moved")

Thanks,

Prabu

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 04, 2017 Apr 04, 2017

Copy link to clipboard

Copied

Ananth:

Thank you for sending this over. So, I understand what your doing in terms of the coordinates. So, lets say that the X= -1.5 but the Y= .72" below the page size. Keep in mind that the page size could vary and therefore I need the box to always be .72 below the page size no matter the size.

Best, John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 04, 2017 Apr 04, 2017

Copy link to clipboard

Copied

LATEST

I was finally able to figure out that I should use the myDocument.documentPreferences.pageHeight property within my move statement. This will require the move to get the height of the document.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines