3 Replies Latest reply on Feb 1, 2009 1:30 PM by Harbs.

    Findout Page coordinates of a frame.


      Writing Java scripts for the Indesign CS3.
      Enumerate through the xml content and get the image and text frames.
      Need to detect Page coordinates of them.

      When I wrote the same code in c++, I was get pasteboard coordinates of the rectangle and page, substract results and get necessary shift for rectangle coordinates. But now, when I use a script, I do not know, how to get pasteboard coordinates of the page.

      For Frames I have find out the string:

      "myFrame.resolve([[myFrame.bounds[1], myFrame.bounds[0]], AnchorPoint.TOP_LEFT_ANCHOR], CoordinateSpaces.PASTEBOARD_COORDINATES);"

      But even here I'm not sure in the right order of the bounds[0 & 1].
      How to get the page coordinates of a frame?

      Thank's for your notice.
        • 1. Re: Findout Page coordinates of a frame.
          Level 1
          Hi Alex,

          CoordinateSpaces.pasteboardCoordinates is the global measurement system--that is, it extends behind all pages and all spreads, and it is always in points, regardless of your current units of measurement. Is that really what you want?

          If you're working with objects that have not been transformed (scaled or rotated), then it's usually easier to work with geometricBounds, which returns the bounds of the object in current ruler units, in the form: y1, x1, y2, x2. If you set your ruler origin to page origin, then the values you get back will match those you see in the user interface (in the Control panel and the Transform panel). Is that what you're looking for?


          • 2. Re: Findout Page coordinates of a frame.
            Level 1
            Thank you, very match, Olav.

            "myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;"

            Best Regars and good luck!.
            • 3. Re: Findout Page coordinates of a frame.
              Harbs. Level 6

              I never noticed that resolve function before! I could probably come up
              with some scenarios where it would be useful!

              FWIW, visibleBounds is usually better than geometricBounds. It works on
              transformed objects as well.