2 Replies Latest reply on Sep 21, 2011 6:00 AM by Pet Re

    Getting geometricBounds of a text insertion point [CS5 JavaScript]

    Pet Re

      The question applies to automated placing an image on the exact location of the paragraph that holds the reference to that image. The image must *not* be placed inline. Although I have a method for doing so, I wonder if there is another, cleaner way.

      Text example:


      paragraph of story.


      ***img001<tab>This paragraph holds the image name and the caption.


      next paragraph of story.


      I've written a script that reads out the image reference (the cursor is inside the paragraph) and places the image and caption in a seperate frame on the page.

      To get the location of the paragraph that starts with ***img I place a temporary small inline frame at the start of that paragraph. Then I read out the geometric bounds of that inline frame, delete it and use those coordinates to place the image frame on that vertical location.


      The script works fine, but getting the insertion point's coordinates seems a bit of a detour. Maybe it's the only way, but if anyone has a suggestion for a neater approach I would be interested.