Skip to main content
Participating Frequently
October 13, 2010
Question

Is there a way to obtain absolute page position of any item?

  • October 13, 2010
  • 1 reply
  • 392 views

I want to obtain the absolute page position of an item created through scripting. Let me give you an example. I have created a rectangle inside a cell:

    var tempRectangle = cell.insertionPoints.item(-1).rectangles.add({
        geometricBounds = [0,0,cell.height,cell.width];
        });

But, because of dynamic content being loaded into the table, there could be any number of rows before this cell and so the cell can be anywhere on the page. I simply want to read the geometric bounds of the rectangle relative to the page rather than relative to the cell, so I can find out where the rectangle actually is. Don't ask why, I just do!

So, is there any way of obtaining the geometric bounds relative to the whole page, or otherwise finding an absolute upper-left edge, or any position relative to the page? I know I can calculate it by keeping track of everything that came before it and what's around it and adding everything up, but that's extremely tedious and inelegant and knowing me, I'll write it badly and it'll be inaccurate.

Thank you in advance to anyone who can help one way or another!

This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
October 13, 2010

Frame,

After you've placed an item in a table, that item's geometricBounds are relative to the page (well, the page's/spread's rule origin), not the cell.

Peter