Skip to main content
danielg98770948
Known Participant
April 4, 2019
Question

How to find an image's insertion point?

  • April 4, 2019
  • 1 reply
  • 340 views

I'm going through the document finding all images.  I then want to find the insertion point for each images.  How do I do that?  image.insertionPoints[0] isn't working.

var images = app.activeDocument.allGraphics;

var number_of_images = images.length;

for (i=0; i<number_of_images; i++)

{

    image = images.parent;

    find insertion point here??

}

This topic has been closed for replies.

1 reply

TᴀW
Legend
April 4, 2019

If the image is an inline or anchored object, then the parent of the image is a Character object. A Character has 2 insertionPoints (the one in front of the character and the one after it). So, if the object is indeed anchored or inline:

myInsertionPoint = images.parent.insertionPoints[0]; // or insertionPoints[1] if you want the 2nd insertionPoint.

If the image is not anchored, its parent will be a spread normally...

Ariel

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
danielg98770948
Known Participant
April 4, 2019

Thank you!