How to convert PPTX to PDF in PHP with Aspose.Slides REST API

Hello,

After installing the solution with this link: GitHub - aspose-slides-cloud/aspose-slides-cloud-php: PHP library for communicating with the Aspose.Slides Cloud API.

I have created my appId and my appKey.

When I test the example code, it gives me the error on
‘$result = $api->convert(fopen($path, ‘r’), ExportFormat::PDF);’ :

‘Argument 2 passed to AsposeSlidesCloudSdk\ApiSlidesApi::convert() must be an instance of AsposeSlidesCloudSdk\Api\string, string given’

Thank you for your help.

@lcar

Please check the following sample PHP code to convert PPTX to PDF. Hopefully, it will help you to accomplish the task. You may also check the detail of convert method from the PHP unit tests.

<?php

require_once('D:\xampp\htdocs\aspose-slides-cloud-php-master\vendor\autoload.php');

//TODO: Get your AppSID and AppKey at https://dashboard.aspose.cloud (free registration is required).

$configuration = new Aspose\Slides\Cloud\Sdk\Api\Configuration();
$configuration->setAppSid("xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx");
$configuration->setAppKey("xxxxxxxxxxxxxxxxxxxxxxxx");

$slidesApi = new Aspose\Slides\Cloud\Sdk\Api\SlidesApi(null,$configuration); 

try {
	
// Upload source document to Storage
$testdocument = fopen("C:/Temp/Test.pptx", 'r');
$testformat = "pdf";
$testpassword = null;
$testfontsfolder = null;		
                	
$response = $slidesApi->convert($testdocument, $testformat, $testpassword, $testfontsfolder);

echo "Completed!!!!";
    
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";
    PHP_EOL;
}

?>

Hi,

Thank you for your help, but I have the same error.

Argument 2 passed to Aspose\Slides\Cloud\Sdk\Api\SlidesApi::convert() must be an instance of Aspose\Slides\Cloud\Sdk\Api\string, string given … at …/aspose/slides-sdk-php/sdk/Api/SlidesApi.php line 25335

@lcar

Please ensure that are using the latest Aspose.Slides Cloud SDK for PHP 21.3. Hopefully, it will resolve the issue.

According to my composer.json, I have the version 21.3

@lcar

We are sorry for the inconvenience. The following code is working fine at my end. Please share your sample working code. It will help us to replicate the issue and investigate it.

// Upload source document to Storage
$testdocument = fopen("C:/Temp/Test.pptx", 'r');
$testformat = "pdf";
$testpassword = null;
$testfontsfolder = null;		
//$request = new Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesConvertRequest($testdocument, $testformat, $testpassword, $testfontsfolder);
                	
//$response = $slidesApi->convert($testdocument, $testformat, $testpassword, $testfontsfolder);
$response = $slidesApi->convert($testdocument, $testformat);

echo "Completed!!!!";

A post was split to a new topic: Merging PowerPoint slides intermittently throws 400 Client error