Examine Presentation

Aspose.Slides for Java allows you to examine a presentation to find out its properties and understand its behavior.

Checking a Presentation Format

Before working on a presentation, you may want to find out what format (PPT, PPTX, ODP, and others) the presentation is in at the moment.

You can check a presentation’s format without loading the presentation. See this sample code:

IPresentationInfo info = PresentationFactory.getInstance().getPresentationInfo("pres.pptx");
System.out.println(info.getLoadFormat()); // PPTX

IPresentationInfo info2 = PresentationFactory.getInstance().getPresentationInfo("pres.ppt");
System.out.println(info2.getLoadFormat()); // PPT

IPresentationInfo info3 = PresentationFactory.getInstance().getPresentationInfo("pres.odp");
System.out.println(info3.getLoadFormat()); // ODP

Getting the Properties of a Presentation

This sample code in Java shows you how to get a presentation’s properties (information about the presentation):

IPresentationInfo info = PresentationFactory.getInstance().getPresentationInfo("pres.pptx");
IDocumentProperties props = info.readDocumentProperties();
System.out.println(props.getCreatedTime());
System.out.println(props.getSubject());
System.out.println(props.getTitle());
// .. 

Updating the Properties of a Presentation

Aspose.Slides provides the PresentationInfo.updateDocumentProperties method that allows you to make changes to a presentation’s properties.

This sample code shows you how to edit the properties for a presentation in Java:

IPresentationInfo info = PresentationFactory.getInstance().getPresentationInfo("pres.pptx");

IDocumentProperties props = info.readDocumentProperties();
props.setTitle("My title");
info.updateDocumentProperties(props);

To get more information about a presentation and its security attributes, you may find these links useful: