How to convert Microsoft PowerPoint Presentation(PPT) to ODP in PHP

I am trying to convert the ppt file to odp in PHP but it gives me error

$api = new SlidesApi(null, $config);
$request = new PostSlidesConvertRequest(ExportFormat::ODP, 
fopen('/opt/lampp/htdocs/rr/web/img_assets/documents/newold.pptx', 'r'));
$result = $api->postSlidesConvert($request);
echo "My PDF was saved to " . $result->getPathname();

here this error message preg_match() expects parameter 2 to be string, resource given

@fejan2020

Can you please share which Aspose API on back end you are using? Are you using Cloud SDK or Aspose.Slides for .NET/Java on your end.

Thanks for reply i am using aspose slides in php to convert ppt file to odp or is this plugin support the ppt viewer for web page

@fejan2020

Can you please share the source PPT file that you are converting to ODP and is getting failed. I will be needing to verify that on my end to investigate the issue further.

@fejan2020

We have tested to convert Microsoft PowerPoint Presentation(PPT) to ODP using the latest version of Aspose.Slides Cloud SDK for PHP and were unable to reproduce the issue. Please check the following sample PHP code for PostSlidesConvertRequest parameters details and usage. Hopefully, it will help you to accomplish the task.

Converting PPT to ODP in PHP

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

Thnaks for reply I will soon try this code

1 Like