Changing the Slide Aspect Ratio from Default 4:3 to Wide Screen Using PHP

Hi, we have built out an MVP very successfully using PHP. ASPOSE fits the bill very nicely on everything we want to do bar one thing. Currently we are using slide templates that are created at widescreen but ASPOSE is converting them to a default 4:3 which means when we pump out the end product, only half the slide can be viewed. I notice you can change the aspect ratio of the slides from default to widescreen using JAVA or .NET but there does not appear to be any documentation on how you might do this using PHP? Is this, as I hope, merely a hole in the documentation or is this actually a limitation on ASPOSE functionality?

Ultimately what we would like to do is use our widescreen slides and keep them widescreen throughout the build (we create a deck made up of various slide templates based on the output of a survey. As I said earlier, everything else works like a dream, we just need to overcome this final hurdle, can anyone help please?

@g2landrew,
Thank you for contacting support.

You can use the SetSlideProperties method as follows:

use Aspose\Slides\Cloud\Sdk\Api\Configuration;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi;
use Aspose\Slides\Cloud\Sdk\Model\SlideProperties;

$configuration = new Configuration();
$configuration->setAppSid("MyClientId");
$configuration->setAppKey("MyClientSecret");

$slidesApi = new SlidesApi(null, $configuration);

$fileName = "sample.pptx";

$slideProperties = new SlideProperties();
$slideProperties->setSizeType("Widescreen");
$slideProperties->setScaleType("EnsureFit");

$slidesApi->setSlideProperties($fileName, $slideProperties);

Please let us know if you have any difficulty with this. We will improve our documentation.

Thank you Andrey, let me give it a go, I’ll come back to you if I have any more problems.

@g2landrew,
We will be waiting for your feedback. Thank you for using Aspose.Slides Cloud.

Hi Andrey, It doesnt appear to have worked, I have asked our lead developer to join this forum and he will post his question shortly

Many thanks

Hi Andrey

I am the developer on this project. We are using SDK 23.7 with PHP 8.1.17, running your example as-is gives the following error:

Fatal error: Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [404] Client error: PUT https://api.aspose.cloud/v3.0/slides/sample.pptx/slideProperties resulted in a 404 Not Found response:
{“requestId”:“a2b54a27-e973-4b0d-aaa8-795c8372fe0b”,“error”:{“code”:“errorAmazonS3Storage”,“message”:"AmazonS3 Storage e (truncated…)
in ./composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php:89
Stack trace:
#0 ./composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(36833): Aspose\Slides\Cloud\Sdk\Api\ApiBase->httpCall()
#1 ./composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(36817): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->setSlidePropertiesWithHttpInfo()
#2 ./composer/test.php(22): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->setSlideProperties()
#3 {main}
thrown in ./composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 89

Changing the $fileName value to “Data/sample.pptx” gives a different error:

Fatal error: Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [405] Client error: PUT https://api.aspose.cloud/v3.0/slides/Data/sample.pptx/slideProperties resulted in a 405 Method Not Allowed response in ./composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php:89
Stack trace:
#0 ./composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(36833): Aspose\Slides\Cloud\Sdk\Api\ApiBase->httpCall()
#1 ./composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(36817): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->setSlidePropertiesWithHttpInfo()
#2 ./composer/test.php(22): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->setSlideProperties()
#3 {main}
thrown in ./composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 89

@g2landrew, @matthewg2l,
Thank you for the message.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESCLOUD-1801

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@matthewg2l,
As you use the path “Data/sample.pptx”, we assume the file is located in the Data folder. If so, you should specify the folder parameter as follows:

$fileName = "sample.pptx";
$folder = "Data";

$slideProperties = new SlideProperties();
$slideProperties->setSizeType("Widescreen");
$slideProperties->setScaleType("EnsureFit");

$slidesApi->setSlideProperties($fileName, $slideProperties, null, $folder);

Hi Andrey

Thanks for that, I shall give it a go… Are the function parameters documented anywhere? I haven’t been able to find anything.

Thanks

Matthew

@matthewg2l,
Unfortunately, the Aspose.Slides Cloud documentation does not describe the method yet. We will add an article as soon as possible. We apologize for any inconvenience. In the meantime, you can see all the parameters of the SetSlideProperties method here.

A post was split to a new topic: Replace an Image in a Presentation Using Aspose.Slides Cloud SDK for PHP