
PowerPoint Presentations have properties containing details about a presentation such as a title, author name, subject, and keywords that identify the document’s topic or contents, etc. It is important to specify relevant values for the presentation’s Property attributes because they help to identify the presentation. Whereas, the individual slides within the presentation have properties associated with them such as Height, Width, Orientation, slide index in presentation, SizeType, etc. Aspose.Slides Cloud enables you to programmatically Set PPTX Protection Properties.
Quick Tip
Use the following command to identify the current hosted version of Aspose.Slides Cloud API,
curl -X GET "https://api.aspose.cloud/v3.0/slides/info" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"
Response Body
{ "name": "Aspose.Slides for Cloud", "version": "21.1.0" }
Now we are going to shed some light regarding following topics in this blog.
Get Slide Properties
Aspose.Slides Cloud provides the capabilities to get Slide Properties using the cURL command and at the same time, you may try using the language-specific programming SDK to fulfill your requirements.
cURL command
curl -X GET "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"
Request URL
https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties
Response Body
{ "firstSlideNumber": **1**, "orientation": "Landscape", "sizeType": "Widescreen", "width": **960**, "height": **540**, "selfUri": { "href": "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties", "relation": "self" } }
C# .NET
// complete examples can be found over https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet | |
string MyAppKey = "xxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/ | |
string MyAppSid = "xxxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/ | |
try | |
{ | |
// instantiate SlidesAPI object | |
Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret); | |
// Create GetSlidesSlidePropertiesRequest object and provide input PPTX reference | |
GetSlidesSlidePropertiesRequest request = new GetSlidesSlidePropertiesRequest { Name = "input.pptx" }; | |
// Read Slide properties | |
SlideProperties slideProperties = slidesApi.GetSlidesSlideProperties(request); | |
// display First slide number details | |
Console.WriteLine(slideProperties.FirstSlideNumber); | |
// print orientation details of slide | |
Console.WriteLine(slideProperties.Orientation); | |
// print the height details for slide | |
Console.WriteLine(slideProperties.Height); | |
// print width details for slide | |
Console.WriteLine(slideProperties.Width); | |
// print information related to scaleType | |
Console.WriteLine(slideProperties.ScaleType); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling Api: " + e.ToString()); | |
} |
Set PPTX Slide Properties
Nevertheless, Aspose.Slides Cloud is fully capable of setting the properties for PowerPoint slides and in following section, we have explained the related steps
cURL command
curl -X PUT "https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>" \
-H "Content-Type: application/json" \
-d "{ \"FirstSlideNumber\": 0, \"Orientation\": \"Portrait\", \"ScaleType\": \"DoNotScale\", \"SizeType\": \"OnScreen\", \"Width\": 600, \"Height\": 900, \"SelfUri\": { \"Href\": \"https://api.aspose.cloud/v3.0/slides/input.pptx/slideProperties\", \"Relation\": \"self\", \"LinkType\": \"\", \"Title\": \"Hello\" }, \"AlternateLinks\": [ { \"Href\": \"string\", \"Relation\": \"string\", \"LinkType\": \"string\", \"Title\": \"string\" } ]}"
C# .NET
// please viist following link for complete source code https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet | |
try | |
{ | |
String Client_ID = "xxxxxxxx-1c8e-4ea4-a948-3857547232fa"; | |
String Client_Secret = "xxxxxxxx237f013e329cdf5694cc96a"; | |
// instantiate SlidesAPI object | |
Aspose.Slides.Cloud.Sdk.SlidesApi slidesApi = new Aspose.Slides.Cloud.Sdk.SlidesApi(Client_ID, Client_Secret); | |
// Create PutSlidesSlidePropertiesRequest object and provide input PPTX as argument | |
PutSlidesSlidePropertiesRequest request = new PutSlidesSlidePropertiesRequest { | |
// speicfy input PowerPoint presentation | |
Name = "input.pptx", | |
Dto = new SlideProperties { | |
Width = 900, | |
Height = 600, | |
Orientation = SlideProperties.OrientationEnum.Portrait, | |
ScaleType = SlideProperties.ScaleTypeEnum.DoNotScale, | |
SizeType = SlideProperties.SizeTypeEnum.OnScreen, | |
} | |
}; | |
SlideProperties response = slidesApi.PutSlidesSlideProperties(request); | |
// read the width property of slide | |
Console.WriteLine(response.Width); | |
// read the height property of slide | |
Console.WriteLine(response.Height); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling Api: " + e.ToString()); | |
} |
Get Slide Protection Properties
The GetSlidesProtectionProperties method of API provides the capabilities to read the protection properties of presentation documents.
curl -X GET "https://api.aspose.cloud/v3.0/slides/input.pptx/protectionProperties" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"
C# .NET
// please viist following link for complete source code https://github.com/aspose-slides-cloud/aspose-slides-cloud-dotnet | |
try | |
{ | |
String Client_ID = "xxxxxxx-1c8e-4ea4-a948-3857547232fa"; | |
String Client_Secret = "xxxxxxxx237f013e329cdf5694cc96a"; | |
// instantiate SlidesAPI object | |
SlidesApi slidesApi = new SlidesApi(Client_ID, Client_Secret); | |
// Create PutSlidesSlidePropertiesRequest object and provide input PPTX as argument | |
GetSlidesProtectionPropertiesRequest request = new GetSlidesProtectionPropertiesRequest | |
{ | |
// speicfy input PowerPoint presentation | |
Name = "input.pptx", | |
}; | |
ProtectionProperties slideProperties = slidesApi.GetSlidesProtectionProperties(request); | |
// read the width property of slide | |
Console.WriteLine("Encrypted Document Properties = "+slideProperties.EncryptDocumentProperties); | |
Console.WriteLine("Read Only Recommended = "+slideProperties.ReadOnlyRecommended); | |
Console.WriteLine("Self URi = " + slideProperties.SelfUri); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling Api: " + e.ToString()); | |
} |
Deprecated Methods
PUT fromHtml method is deprecated and will be deleted in the 21.4 release. Use the POST fromHtml method to create presentations and also add new slides to them.
slideSize resource is deprecated and will be deleted in the 21.4 release. Use slideProperties resource instead.
Conclusion
In this article, we have explored the capabilities of Aspose.Slides Cloud to set PPTX Protection Properties, get Slide Protection Properties, Get Slide Properties using C# .NET as well as a cURL command. You may easily download the complete source code of Aspose.Slides Cloud SDK for .NET from GitHub. In order to learn more about SDK capabilities, please explore the Developer Guide.