• 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

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

Views

1.5K

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
Community Expert ,
Apr 02, 2017 Apr 02, 2017

Copy link to clipboard

Copied

If you don't get an answer here, ask in the InDesign Scripting forum here:

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 02, 2017 Apr 02, 2017

Copy link to clipboard

Copied

Steve - I must have missed the other forum. I have posted in that forum as well. If I get a response there that works, I will be sure to post it here as well. Thank you for your help.

-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
Adobe Employee ,
Apr 02, 2017 Apr 02, 2017

Copy link to clipboard

Copied

Hi Davidson

Are you trying that your created text frame should overlap the bleed area you have set in the script. If this is so, you just have to make changes while setting the geometric bounds of the text frame as:

myTextFrame.geometricBounds = [-2, -2, 13, 10.5];

You can change the ruler measurement unit to inches by going to the Edit - Preferences - Units and Increment so that everything can be given in inches which you have done while setting the bleed area.

So now you have the page width and the bleed area that span 2 inches from the page on all side. The page width and height are 8.5 in and 11 in respectively. Keeping this in mind you just have to set geometric bounds as:

myTextFrame.geometricBounds = [-2(Bleed offset value), -2(Bleed offset value), 13(height of page + blead offset), 10.5(width of page + bleed offset value)];

Hope this answers what you are trying to do !

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

Rohit - Thank you for posting. I guess, I didn't explain correctly. I am really looking to move the text box outside of the page area so that the X-Coordinate would be -1.5161 and the Y-Coordinate would be .72 below the page all the time. Keep in mind that the script is going to be run on any page size, so it needs to reference the page height then +.72. I just haven't been able to make it work properly.

Any help would be great.

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