Examine Presentation
Aspose.Slides for PHP via Java allows you to examine a presentation to find out its properties and understand its behavior.
Info
The PresentationInfo and DocumentProperties classes contain the properties and methods used in operations here.Check 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 PHP code:
$info = PresentationFactory->getInstance()->getPresentationInfo("pres.pptx");
echo($info->getLoadFormat());// PPTX
$info2 = PresentationFactory->getInstance()->getPresentationInfo("pres.ppt");
echo($info2->getLoadFormat());// PPT
$info3 = PresentationFactory->getInstance()->getPresentationInfo("pres.odp");
echo($info3->getLoadFormat());// ODP
Get Presentation Properties
This PHP code shows you how to get presentation properties (information about the presentation):
$info = PresentationFactory->getInstance()->getPresentationInfo("pres.pptx");
$props = $info->readDocumentProperties();
echo($props->getCreatedTime());
echo($props->getSubject());
echo($props->getTitle());
# ..
You may want to see the properties under the DocumentProperties class.
Update Presentation Properties
Aspose.Slides provides the PresentationInfo.updateDocumentProperties method that allows you to make changes to presentation properties.
Let’s say we have a PowerPoint presentation with the document properties shown below.
This code example shows you how to edit some presentation properties:
$fileName = "sample.pptx";
$info = PresentationFactory::getInstance()->getPresentationInfo($fileName);
$properties = $info->readDocumentProperties();
$properties->setTitle("My title");
$properties->setLastSavedTime(new Java("java.util.Date"));
$info->updateDocumentProperties($properties);
$info->writeBindedPresentation($fileName);
The results of changing the document properties are shown below.
Useful Links
To get more information about a presentation and its security attributes, you may find these links useful: