Convert PowerPoint Presentation Slide to HTML in PHP with Aspose.Slides REST API

Hi,

I tried to convert a basic PPTX file to HTML with the PDF SDK and it’s returning me an empty HTML.

Output:

<!DOCTYPE html><html><head><title></title></head><body><?xml version="1.0" encoding="utf-8" standalone="yes"?>

Code is very basic for now:

    $request = new Aspose\Slides\Cloud\Sdk\Model\Requests\GetSlideWithFormatRequest('sample.pptx', 1, 'html');
    $config = new Aspose\Slides\Cloud\Sdk\Api\Configuration();
    $config->setAppSid("*****");
    $config->setAppKey("****");
        
    $slidesApi = new Aspose\Slides\Cloud\Sdk\Api\SlidesApi(null, $config);
    $result = $slidesApi->GetSlideWithFormat($request);
    var_dump($result->__toString());

sample.pptx file is well found; i did upload it manually in the backend (because the Utils.php file is nowhere; will have to make a cURL request to post the file…). But the returned HTML is empty here…

Here is the PPTX file.
sample.pptx.zip (209.5 KB)

If someone has any idea ? Or i will look for another provider; just started my test and nothing is working as expected :frowning:

@cfeuvre

Thanks for your inquiry. Please check following PHP code snippet, to upload PPTX file to storage and convert the specific slide to HTML filetestslide.zip (4.6 KB). Hopefully it will help you to accomplish the task.

Furthermore, you can check the github repo of Aspose.Slides Cloud SDK for PHP for more examples.

require_once('C:\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).

$AppKey="xxxxxxxxxxxxx";
$AppSid="xxxxxxxxxxxxxxx";

$configuration = new Aspose\Slides\Cloud\Sdk\Api\Configuration();
$configuration->setAppSid($AppSid);
$configuration->setAppKey($AppKey);

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

$storageApi = new Aspose\Storage\Api\StorageApi();
$storageApi->getConfig()->setAppKey($AppKey)->setAppSid($AppSid);

try {
		
	$testname = "sample.pptx";
	$testslideIndex =1;
	$testformat="html";
	$testwidth=null;
	$testheight=null;
	$testpassword=null;
	$testfolder=null; 
	$teststorage=null;
	$testoutPath="output/testslide.html"; 
	$testfontsFolder=null;
    
	$file = "D:/Downloads/sample.pptx/".$testname;
	$version_id = null;
    $storage = null;
	$putRequest = new Aspose\Storage\Model\Requests\PutCreateRequest($testname, $file, $version_id, $storage);
	$storageApi->PutCreate($putRequest);
    	
	$request = new Aspose\Slides\Cloud\Sdk\Model\Requests\GetSlideWithFormatRequest($testname, $testslideIndex, $testformat, $testwidth, $testheight, $testpassword, $testfolder, $teststorage, $testoutPath, $testfontsFolder);
	        	
    $response = $slidesApi->getSlideWithFormat($request);
    echo "Done....";
    
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";
    PHP_EOL;
}