Skip to main content
Inspiring
July 9, 2020
Answered

Add a Text box the size of the page with stroke to page?

  • July 9, 2020
  • 2 replies
  • 370 views

I looked and am probably wording it incorrectly in my searches. Is there a script that adds a text Frame (the size of the Page) and adds a stroke around it? and if possible can it also have a corner radious?

This topic has been closed for replies.
Correct answer Laubender

Hi cbishop01,

you could try this with reading out the bounds of a page and use the resulting array for the geometricBounds of an added text frame. The corner radius of a text frame is defined in four pairs of properties. Here an example with the top right corner on page 1:

 

var doc = app.documents[0];
var page = doc.pages[0];

page.textFrames.add
(
	{
		geometricBounds : page.bounds ,
		fillColor : "None" ,
		
		strokeColor : "Black" ,
		strokeWeight : "1Pt" ,
		
		strokeAlignment : StrokeAlignment.INSIDE_ALIGNMENT ,
		
		topRightCornerRadius : "10mm" ,
		topRightCornerOption : CornerOptions.ROUNDED_CORNER
	}
);

 

For all other needed properties see the DOM documentation compiled by Gregor Fellenz:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html

 

There could be complications if the pages are transformed, but for an ordinary document this should work.

 

Regards,
Uwe Laubender

( ACP )

2 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
July 9, 2020

Hi cbishop01,

you could try this with reading out the bounds of a page and use the resulting array for the geometricBounds of an added text frame. The corner radius of a text frame is defined in four pairs of properties. Here an example with the top right corner on page 1:

 

var doc = app.documents[0];
var page = doc.pages[0];

page.textFrames.add
(
	{
		geometricBounds : page.bounds ,
		fillColor : "None" ,
		
		strokeColor : "Black" ,
		strokeWeight : "1Pt" ,
		
		strokeAlignment : StrokeAlignment.INSIDE_ALIGNMENT ,
		
		topRightCornerRadius : "10mm" ,
		topRightCornerOption : CornerOptions.ROUNDED_CORNER
	}
);

 

For all other needed properties see the DOM documentation compiled by Gregor Fellenz:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html

 

There could be complications if the pages are transformed, but for an ordinary document this should work.

 

Regards,
Uwe Laubender

( ACP )

jmlevy
Community Expert
Community Expert
July 9, 2020

I don't know if a such script exists (certainly yes) but it is easy to draw a rounded corner frame on the master page and apply this master page on the pages you need. Better place this frame on a separate layer, under the others.