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

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

Advisor ,
Jul 09, 2020 Jul 09, 2020

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?

TOPICS
Scripting
344
Translate
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

Community Expert , Jul 09, 2020 Jul 09, 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 : StrokeAlign
...
Translate
Community Expert ,
Jul 09, 2020 Jul 09, 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.

Translate
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
Community Expert ,
Jul 09, 2020 Jul 09, 2020
LATEST

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 )

Translate
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