Mobile app version of vmapp.org
Login or Join
Heady304

: InDesign: Place textframes relative to other textframes, with automatic repositioning on resize I use javascript to create an inDesign file containing multiple textframes. During script runtime, the

@Heady304

Posted in: #Adobe #AdobeIndesign #IndesignScripting

I use javascript to create an inDesign file containing multiple textframes. During script runtime, the textframes are easily positioned at the right place.

The problem arises, when I change the text in a textframe afterwards, e.g., by deleting one line of text in a frame that has a second frame below it. Instead of having all text frames with absolute coordinates on the screen, I want to have them relative to each other, with automatic updates.

Simply said, I want to have an analogous concept to linking text frames (such that the text flows to the previous frame), but for moving frames.

How can this be achieved? I tried nesting and anchoring, but this wasn't helpful. Putting all frames in "automatically resize in height" + anchoring every frame to its predecessor would work, but I cannot anchor them to the previous textframe.

Example:

var doc = app.documents.item(0);
var page = doc.pages.item(0);
var x1 = 50, y1 = 50, x2 = 100, y2 = 100;
var firstFrame = page.textFrames.add({geometricBounds: [y1, x1, y2 x2]});

// Wrong, no absolute coordinates!
var secondFrame = page.textFrames.add({geometricBounds: [y2, x2, y2+50, x2+50]});

// "right":
var x3 = reference to firstFrame.geometricBounds[1], that is linked
var y3 = reference to firstFrame.geometricBounds[1], that is linked
var secondFrame = page.textFrames.add({geometricBounds: [y3, x3, y3+50, x3+50]});

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady304

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme