Skip to main content
Inspiring
June 29, 2022
Question

Text On Shape.

  • June 29, 2022
  • 2 replies
  • 478 views

I want to write text on shape (not on path) without creating new textbox reffering adobe indesign sdk 2022 functions.for example ,write text on rectangle.How to write it using sdk functions.

This topic has been closed for replies.

2 replies

Community Expert
June 30, 2022

Hi @Madhuri1 ,

I'm not exactly sure what you like to do and I cannot help you with the SDK side of things here, but you could do perhaps the following:

 

Let's assume you have one text frame (TF) with one path and a graphic frame (GF) with an arbitrary shape with one path. Spoken in ExtendScript terms you could set the entirePath array of the first path of the TF to the entirePath array of the first path of the GF to shape the text frame according to the path of the graphic frame.

 

//ExtendScript
var TF = app.selection[0];
var GF = app.selection[1];

TF.paths[0].entirePath = GF.paths[0].entirePath;

 

Before:

After script run:

 

Of course this is a very simplistic approach and does not account for example the transformation of an object.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

manal shanableh
Legend
June 29, 2022

you can draw any closed shape you want with pen tool for example, or creat any shape, just go to type tool, click inside the shape and start writing or paste a text inside..

 

or righ mouse click on the shape> content> Text

Madhuri1Author
Inspiring
June 29, 2022

It is from UI side. I know how to add text on shape. I want to know about (command/function) for it from indesign sdk .

Legend
June 30, 2022

"I know how to add text on shape" - actually it would have been a good idea to desribe in UI terms what you're trying to achieve.

Assuming it is indeed the step described by Manal, that would be kConvertItemToTextCmdBoss where the UIDList is your kSplineItemBoss. The command invokes others such as kNewStoryCmdBoss, kNewFrameCmdBoss and so forth, so it will create a text frame (not box) and combine it with your shape.