C++SDK How do I convert spread coordinates to page coordinates?
I obtained the spread coordinates using the TransformInnerPointToSpread method. I want to convert these to page coordinates.
I obtained the spread coordinates using the TransformInnerPointToSpread method. I want to convert these to page coordinates.
I didn't find any directway to achieve this because PageItrems belongs to spread and not on page.
But this could be achieved.
1. Convert PageItem coordinates to Pasteboard Coordinates.
2. Convert Page coordinates to Pasteboard Coordinates.
3. Now simply, adjust the coordines for eg - pageItem.Left() - Page.Left().
Refer the following snippet -
InterfacePtr<IGeometry> iPageGeometry(pageUIDRef, UseDefaultIID());
InterfacePtr<IGeometry> iPageItemGeometry(frameUIDRef, UseDefaultIID());
PBPMRect pageRectInPasteboardCoordinates = iPageGeometry->GetStrokeBoundingBox(::InnerToPasteboardMatrix(iPageGeometry));
PMRect frameRect = iFrameGeometry->GetBoundingBox(Geometry::OuterStrokeBounds());
::TransformInnerRectToPasteboard(iFrameGeometry, &frameRect); // convert to pasteboard coordinates.
PMRect pageItemRectInPageCoordinates= PMRect(frameRect.Left() - pageRect.Left(),
frameRect.Top() - pageRect.Top(),
frameRect.Left() - pageRect.Left() + frameRect.Width(),
frameRect.Top() - pageRect.Top() + frameRect.Height());Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.