3 Replies Latest reply on Jul 16, 2013 9:48 AM by Laubender

    Anchored items size with javascript

    KENOBEE

      Hi all,

       

      I try to get the size of an item in my InDesign page, with the function geometricBounds.

      It causes a problem when my item is anchored to another one : I only get the bounds of the main item and not the anchored one (see the red arrow in the sreenshot).

      I can't detect the second item with script, because it isn't a real item, just an anchored item to the other one. I can't make a group with these two items neither.

      If I export an image file for this item, I get the main item and the anchored one.

       

      Is there a solution to get the size of the whole object ?

       

      Thanks,

       

      screenshot.png

        • 1. Re: Anchored items size with javascript
          Jump_Over Level 5

          KENOBEE wrote:

           

          ...I can't detect the second item with script, because it isn't a real item...

           

          Can you select the second item in InDesign?
          Can you see an anchor point for this object anywhere in fextFrame?

           

          Anchored items are as much real as standalone ones. There is only a different way to refer to them.

          Determine if this arrow is an anchored object in fact.

          Starting from attached doc view (textFrame selected)  your arrow geoBounds supposed to be:

           

          app.selection[0].splineItems[0].geometricBounds;
          

           

          ...if arrow is anchored there indeed.

           

          Jarek

          • 2. Re: Anchored items size with javascript
            KENOBEE Level 1

            That seems to work.

             

            Ok so I must check on each items of my group if there is a spline item. Then I have to get all geometrics bounds to get the size of the full group. After that, I could get the real size of my exported image.

            There isn't any easier way ?

             

            I'll post my function to get the full size for other people who are interested.

             

            Thanks for your answer Jarek

            • 3. Re: Anchored items size with javascript
              Laubender Adobe Community Professional & MVP

              Sigh. The case is much more complicated.

              Consider drop shadows, tables that exceed the bounds of text frames, etc.etc.

               

              But you could export the whole group as image, place that same image at 100% scale and measure after placing.

               

              Still, with that method there will be unnecessary "white space" or transparent pixels in your exported image. To get the net size of all writing pixels you have to use cross scripting with e.g. PhotoShop.

               

              Uwe