Free Support Forum - aspose.com

Problem setting slide sizes with Aspose.Slide 15.4.0

Hello Aspose team,

if i create a new presentation, set the SlideSizeType.A3Paper and try to save this presentation, i get a NullPointerException. This behavior occurs also for some other SlideSizeTypes.

There is a dirty workaround. After setting the SlideSizeType, i read the dimension. Then i set the SlideSizeType.Custom and set the previously read dimension as size. Now the presentation is savable.

My code:
public class AsposeSlideSizeWorkaroundTest {

@Test
public void testA3Paper() throws Exception {
final Presentation pres = new Presentation();
pres.getSlideSize().setType(SlideSizeType.A3Paper);

try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
// this throws a NullPointerException
pres.save(out, SaveFormat.Ppt);
}
}

@Test
public void testA3PaperAsCustomWorkaround() throws Exception {
final Presentation pres = new Presentation();
pres.getSlideSize().setType(SlideSizeType.A3Paper);

// workaround: read the a3 dimension and set it again as custom size
final Dimension2D dim = pres.getSlideSize().getSize();
pres.getSlideSize().setType(SlideSizeType.Custom);
pres.getSlideSize().setSize(dim);

try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
// this works
pres.save(out, SaveFormat.Ppt);
}
}
}

Hi Holger,

I have worked with sample code shared by you and have been able to observe the issue specified. It seems to be an issue with Aspose.Slides and an issue with ID SLIDESJAVA-34869 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-34869) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.