Skip to main content
Known Participant
August 11, 2014
Question

How to get the spread coordinates w.r.t. the page?

  • August 11, 2014
  • 1 reply
  • 506 views

The original problem is -

I need to move some InDesign elements form one position to the other. For this I've used ITransformFacade::TransformItems(). Everything is working fine except the case-

- If I try to move the element beyond the spread, InDesign crashes! So the problem is- HOW TO HANDLE THIS CASE?

I'm not really sure if there's a straight-forward solution to handle this case but the possible solution to this that I thought of is that- get the spread coordinates wrt the page and then do a check before moving the items.

So to get the spread coordinates wrt the page, I did this-

PMMatrix page2pb = ::InnerToPasteboardMatrix(pageGeometry);

PMMatrix pb2page = page2pb.Invert();

//bounds

spreadGeometry->GetPathBoundingBox(pb2page)

Now, for the first page/spread, I'm getting absolutely correct coordinates of the spread, but for the other pages I'm getting incorrect y-coordinate! I'm not really sure what wrong am I doing here!

Please guide me. Thanks!

This topic has been closed for replies.

1 reply

Inspiring
August 11, 2014

Hi Shadowfax,

the documentation of GetPathBoundingBox says:

"... if you want a PasteBoardBBox, pass in an InnerToPasteboard Matrix."

But you use a PasteboardToPage matrix. This works for the first spread, because the coordinates of the first spread are identical to the pasteboard coordinates. I think you want to use a SpreadToPage matrix, so you must get the InnerToPastboardMatrix from the spread geometry and combine the two matrixes.

Markus