Skip to main content
Inspiring
June 23, 2019
Answered

How to add frame on each page

  • June 23, 2019
  • 2 replies
  • 743 views

Hi experts,

my script like this:

var myDocument = app.activeDocument;

var myPage = myDocument.pages.everyItem().getElements();

var myTextFrame = myPage.textFrames.add();

myTextFrame.geometricBounds = [0, 0, 280, 210];

myTextFrame.contents = "This is some example text."

but not working, could some one please tell me to fix it.

thanks

regard

John

This topic has been closed for replies.
Correct answer Mike Bro

John,

try looping through the documents pages to add the text frames.

Also you can look at this post how script create text frame ?  as it has a lot of useful information.

var myDocument = app.activeDocument;

for(var p=0; p<myDocument.pages.length; p++){

var myTextFrame = myDocument.pages

.textFrames.add();

myTextFrame.geometricBounds = [0, 0, 280, 210];

myTextFrame.contents = "This is some example text.";

}

Regards,

Mike

2 replies

September 18, 2019

var myDocument = app.documents[0];//app.activeDocument not working on indesign Server

for(var i=0;i<myDocument .pages.length;i++)

{

myDocument .pages[i].textFrames.add();

}

 

Mike BroCorrect answer
Legend
June 24, 2019

John,

try looping through the documents pages to add the text frames.

Also you can look at this post how script create text frame ?  as it has a lot of useful information.

var myDocument = app.activeDocument;

for(var p=0; p<myDocument.pages.length; p++){

var myTextFrame = myDocument.pages

.textFrames.add();

myTextFrame.geometricBounds = [0, 0, 280, 210];

myTextFrame.contents = "This is some example text.";

}

Regards,

Mike

JohnwhiteAuthor
Inspiring
June 24, 2019

thank you mike

thank so much

John