Copy link to clipboard
Copied
How can i cut rectangle into the textFrame script? Please help me
Copy link to clipboard
Copied
This needs more words. And perhaps a few images: do it by hand, and show the difference before/after.
Copy link to clipboard
Copied
Before:
After:
Copy link to clipboard
Copied
Hi,
Try this code!!!
var myDoc = app.activeDocument;
var myTextFrame = myDoc.textFrames.everyItem().getElements();
var ins=app.activeDocument.textFrames.item(0).insertionPoints.item(2);
var Rec = ins.rectangles.add();
Rec.geometricBounds = ["4p","3p", "10p", "10p"]
Thanks,
Prabu G
Copy link to clipboard
Copied
I understood what he is talking about. He wants to cut unanchored text frame or unanchored object into the text frame.
Copy link to clipboard
Copied
Hi Ahmet,
if your version of InDesign is CS5.5 or above you can use the method insertAnchoredObject() of the anchoredObjectSettings of your rectangle. The method requires two arguments: storyOffset and anchoredPosition . storyOffset is an insertionPoint, one in your textFrame you like the rectangle to be anchored with, anchoredPosition is the kind of anchoring you like to do: inline, above line or anchored expressed with enumerators.
Have two objects on page 1 of your document.
A rectangle and a text frame.
var rectangle = app.documents[0].rectangles[0];
var textFrame = app.documents[0].textFrames[0];
// Anchor the rectangle inline at the first insertion point of the text frame:
rectangle.anchoredObjectSettings.insertAnchoredObject( textFrame.insertionPoints[0] , AnchorPosition.INLINE_POSITION );
See also DOM documentation here:
Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting
Regards,
Uwe