Copy link to clipboard
Copied
Hi all,
I'm JavaScript, struggling with the creation of a textFrame along side a Rectangle. I can create the textFrame simply, set its content, and its auto-sizing, but I'm trying to position it's left-center anchor to the right-center anchor of an adjacent Rectangle. For the life of me, I can't seem to get it to work.
I suspect I need to use the resolve() method on the Rectangle to get its location, and then use that when setting the textFrame's geometricBounds, but it keeps appearing far off the page.
Any insights or examples of how this could be done would be welcomed greatly!
Cheers,
Lach
Hi,
I think there is no 1-line code solution.
I suggest to calculate a textFrame geometricBounds regarding to rectangle geometricBounds and create it with [y,x,Y,X] or move existing one to [x,y].
So it looks like mathematic effort.
Jarek
Copy link to clipboard
Copied
Hi,
I think there is no 1-line code solution.
I suggest to calculate a textFrame geometricBounds regarding to rectangle geometricBounds and create it with [y,x,Y,X] or move existing one to [x,y].
So it looks like mathematic effort.
Jarek
Copy link to clipboard
Copied
Yeap, using the rectangle's geometricBounds as the base for the new textFrame's geometricBounds did the trick. Thanks!
Copy link to clipboard
Copied
Hello,
maybe this script will be helpful (at least some its parts ) :
https://sites.google.com/site/dtpscripting/indesign-scripts/makerectangle-jsx
There are options Size > Selection and Content > Text, so you can select the rectangle you need and use the script. Or you can take some functions or blocks of the one. Unfortunately, all the comments there are in Russian
Best wishes,
Sergey
Find more inspiration, events, and resources on the new Adobe Community
Explore Now