Aspect Ratio Export Functionality

Hi,


We currently have a system that imports slides from multiple powerpoint files, and then allows you to mix and match and create/output new custom powerpoint files.

Everything works fine, but we are having an issue with aspect ratios. We output all slides at 16:9 size. However some users may import a 4:3 sized presentation.

Is there any way, in any version of the aspose component to scale down the 4:3 slide and insert it into a 16:9 slide container? Currently, 4:3 slides ‘hang over’ the edges/cut off.

Thanks,
Bav

Hi Bav,


Thanks for your interest in Aspose.Slides.

I have observed your requirement and like to share that the feature for setting the the slide size and orientation is available in Aspose.Slides. You need to develop your own logic in this regard for setting the custom orientation and adjusting all shape size inside every slide with respect to new orientation. Please visit this thread link where I have shared the sample approach that can be used to implement the solution on your end. Please share if I may help you further in this regard.

Many Thanks,

Thanks Mudassir,


That looks like it may do the job, not sure if you resize the shapes, they’ll stay in the right place without testing. Can I confirm with you what version of Aspose you require to do this as I’m currently away from my computer. We currently have version 4.3. Is this functionality/logic available in all versions or is it something new?

Many Thanks,
Bav

Hi Bav,


You may investigate the issue on your end using the version shared by you and if there is any issue you may please use the latest version of Aspose.Slides for .NET 7.0.0 on your end as it will hopefully work in all cases.

Many Thanks,

Hi,

I’ve got it working quite nicely, just a couple of questions. Is this functionality only available for .pptx files? As we have a lot of legacy .ppt files.

Secondly, I can’t seem to change the size of a text field. I know sometimes it can dynamically change the size of the font, but not always. This link:

indicates that there is a TextFrame property on the shape. All I can see is a IsTextHolder property.

Thanks,
Bav

Hi Bav,

You can also implement the similar logic for PPT presentations as well. I have transformed the sample code linked in my former post to work for PPT as well. Please use the following sample code for your convenience.

public static void SetPPTPresentaitonSize()

{

Presentation presentation = new Presentation(“D:\Aspose Data\TestResize.ppt”);

int currentHeight = presentation.SlideSize.Height;

int currentWidth = presentation.SlideSize.Width;

int heightSize = currentHeight - 130;

presentation.SlideSizeType = SlideSizeType.Custom;

Size size=new Size(currentWidth, heightSize);

presentation.SlideSize=size;

float ratioHeight = heightSize / currentHeight;

foreach (Shape shape in presentation.Slides[0].Shapes)

{

shape.Height = (int)(shape.Height * ratioHeight);

}

presentation.Write(“D:\Aspose Data\TestResize2.ppt”);

}

I like to add that the text can be in placeholders, text holders and text frames. Please visit this documentation link for your kind reference which will help you to access every text entity in the presentation. For managing font related properties of PPT presentation, please visit this documentation link.

Many Thanks,

Great, this has helped a lot, thanks again!