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

Anchor the images in the same page using javascript

Explorer ,
Aug 23, 2020 Aug 23, 2020

Copy link to clipboard

Copied

Hi Everyone,

How to anchor the images in the same page using javascript. Please help me!!!

 

Thanks,

Magesh

TOPICS
Scripting

Views

223

Translate

Translate

Report

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 , Aug 24, 2020 Aug 24, 2020

Hi Magesh,

let's assume you want to anchor a rectangle to a text insertion point.

Study the method insertAnchoredObject() of the anchoredObjectSettings of a rectangle object:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#AnchoredObjectSetting.html#d1e383930__d1e384388

 

Basically you need an insertion point and the rectangle, that contains the image you want to anchor.

Let's assume you selected the text frame with the mouse first and added the rectangle to your selection.

Then the f

...

Votes

Translate

Translate
Community Expert ,
Aug 23, 2020 Aug 23, 2020

Copy link to clipboard

Copied

Hi Magesh,

you can anchor graphic frames to text. And you can move around text frames in your document. The anchored frames will move along. What you cannot do: Anchor a graphic frame so that it is visible on one spread but it is anchored to a text on a different spread.

 

That are some basics. I have no idea what you exactly like to do.

 

Show some screenshots with a before and after situation.

And explain better, please. What do you mean by "same page" for example? "same" like what?

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

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
Explorer ,
Aug 24, 2020 Aug 24, 2020

Copy link to clipboard

Copied

Hi Laubender,

Thanks for your reply!!

My question is very simple. InDesign document has the image without an anchor. So we need to provide the anchor to near text (same page or spread) using script.

Mageshwaran_1-1598272321213.png

 

Thanks,

Magesh

 

Votes

Translate

Translate

Report

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 ,
Aug 24, 2020 Aug 24, 2020

Copy link to clipboard

Copied

LATEST

Hi Magesh,

let's assume you want to anchor a rectangle to a text insertion point.

Study the method insertAnchoredObject() of the anchoredObjectSettings of a rectangle object:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#AnchoredObjectSetting.html#d1e383930__d1e...

 

Basically you need an insertion point and the rectangle, that contains the image you want to anchor.

Let's assume you selected the text frame with the mouse first and added the rectangle to your selection.

Then the following will work:

 

 

var myTextFrame = app.selection[0];
var myInsertionPoint = myTextFrame.insertionPoints[0];
var myRectangle = app.selection[1];

myRectangle.anchoredObjectSettings.
insertAnchoredObject
(
myInsertionPoint ,
AnchorPosition.ANCHORED
);

 

 

Regards,
Uwe Laubender

( ACP )

 

// EDITED CODE: AnchorPosition.ANCHORED is needed instead of AnchorPosition.Anchored.

Votes

Translate

Translate

Report

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