ISlideSize.setType property removed from Aspose.Slides for Java API


After upgrading AsposeSlides (java) in my application recently, I realized when my code failed to compile that setType() api is no longer present in ISlideSize interface. When I check the history, looks like this change was introduced from 17.9 release. Release note disappointingly has no mention of it.

Has this been removed on purpose or it’s accidental ? What’s the replacement ? How should one implement the functionality that this API used to provide earlier ??



I have observed your comments. I have shared sample code with you. This will help you to understand.

Presentation pres = new Presentation(“presentation.ppt”);
try {
pres.getSlideSize().setSize(540, 720, SlideSizeScaleType.EnsureFit); // Method SetSize is used for set slide size with scale content to ensure fit
pres.getSlideSize().setSize(SlideSizeType.A4Paper, SlideSizeScaleType.Maximize); // Method SetSize is used for set slide size with maximize size of content
} finally {

Hi Adnan,

Thanks for the reply, but that code didn’t help much. Looks like my query was not clear. I am trying to find out the replacement of setType API that was present in ISlideSize interface till 17.8 release, and removed from 17.9 onwards.

You seem to be explaining setSize, which I already know as there is no change in it, it remains same as before. I am trying to something like this :


How do I do it without setType API ??



I suggest you to please try using following sample code on your end to serve the purpose.

Presentation presOut = new Presentation();

Presentation srcPres = new Presentation("Test.pptx");

presOut.getSlideSize().setSize(srcPres.getSlideSize().getType(), SlideSizeScaleType.EnsureFit);"Saved.pptx",SaveFormat.Pptx);

Hi Mudassir,

Thanks for the solution … can you pls confirm that this would do exactly same thing as what my earlier code was doing ? I am particularly concerned about the second parameter SlideSizeScaleType.EnsureFit, was that being set by default when we used to do setType ??



The SlideScaleType parameters was earlier not in business. One require that when changing slide size. Consider a scenario where you have change the size of slide. It will affect the already added shapes available on slide. You need to set option EnsureFit (which is similar to Old implementation as default) to scale the shapes on slide in appropriate ratio to get fit into new slide size. Likewise, the other Options Maximize and DontScale have their own effects. You can set the appropriate scale type meeting your requirements.

Alright … thanks for the explanation.