We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Shape Frame Returns Wrong Coordinates

We have a system to show ppt slide as image on UI browser and show overlay textboxes over the slide image where ever text in autshape. Below is the code:-

pTxtBody.CenterX = lstShapes[x].Frame.CenterX;
pTxtBody.CenterY = lstShapes[x].Frame.CenterY;
pTxtBody.FlipHorizontal = lstShapes[x].Frame.FlipH;
pTxtBody.FlipVertical = lstShapes[x].Frame.FlipV;
pTxtBody.Height = lstShapes[x].Frame.Height;
pTxtBody.Rotation = lstShapes[x].Rotation;
pTxtBody.Width = lstShapes[x].Frame.Width;
pTxtBody.PositionX = lstShapes[x].Frame.X;
pTxtBody.PositionY = lstShapes[x].Frame.Y;

pTxtBody.PositionX & pTxtBody.PositionY giving the cordinates we place on UI.

But in UI boxes not coming in right position. It means Frame.X and Y giving wrong position.

Just for info , we set scale while loading slide on UI

if (PowerPointFacade.IsValidNormalScreen(aspectRatio))
{
//Set the size of the scaled output
pres.SetScale(600, 450);
}
else if (PowerPointFacade.IsValidWideScreen(aspectRatio)) // Should be widescreen.
{
pres.AspectRatio = PowerPoint.AspectRatioEnum.Widescreen;
pres.SetScale(600, 438);
}
else
{
pres.AspectRatio = PowerPoint.AspectRatioEnum.Custom;
pres.SetScale(700, (int)(Math.Abs(700/aspectRatio)));
}

Let me know how do we get right position ?

@rajesh.agarawalatgmail.com,
Welcome to our community! Thank you for contacting support.

Please check your results using the latest version of Aspose.Slides. If the issue persists, please share the following:

  • input presentation file
  • simple, comprehensive code example that generates an incorrect image
  • output image file