Skip to main content
Legend
Dec 25, 2025 2:08 PM UTC
Answered

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.

Rahul_RastogiCorrect answer
Inspiring
Dec 29, 2025 9:58 AM UTC

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());

1 reply

Rahul_RastogiCorrect answer
Inspiring
Dec 29, 2025 9:58 AM UTC

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());
Translate