Convert PowerPoint Presentation to PDF in PHP using Aspose.Slides REST API issue

I’m a little confused on Convert PowerPoint Documents to other File Formats and it doesn’t seem to be working (but probably my misunderstanding)

Question 1: Difference between “Using storage” and “Without using storage”
What is the difference between these two options? The documentation (
Convert PowerPoint Documents to other File Formats doesn’t explain it.

And in the Without using Storage section the API information section shows it as type PUT, but the example shows it as a POST.

Question 2:
It doesn’t seem to be working for me. Pretty much no matter what I try, I get a 404 error.

PUT: https://api.aspose.cloud/v3.0/slides/convert/pdf?outPath= 
x-aspose-client: php sdk 
x-aspose-client-version: 19.6.0 
Accept: application/json 
Content-Type: application/octet-stream,multipart/form-data 
Authorization: Bearer [deleted] 
Body: PK!*H��J [Content_Types].xml [more deleted, you can see it's a pptx] 

The error message I get back is "[404] Client error: PUT https://api.aspose.cloud/v3.0/slides/convert/pdf?outPath= resulted in a 404 Not Found response:
{“error”:{“code”:“errorItemNotFound”,“message”:“NotFound”,“description”:“Operation Failed. Item Not Found.”,“innerError” (truncated…)

I’ve tried all the options I can think of for the outPath with the same results.

– What I’m really trying to do, is convert an existing “saved” presentation to another format and save it on Aspose storage. But these seems like the only option to convert a complete presentation. Am I missing something?

@klubar

Thanks for your inquiry, Please note there is some type error, we will fix it shortly. Please note both methods, PutSlidesConvert and PostSlidesConvert converts the Presentation from the request body to specified format. However, PutSlidesConvert method saves result to a storage location and PostSlidesConvert method returns result in the response body.

@klubar

We are sorry for your inconvenience. I have noticed the reported issue and log a ticket SLIDESCLOUD-727 for further investigation and rectification. We will notify you as soon as it is resolved.

@klubar

Thanks for your patience. After initial investigation, we found that subjected API works fine with format value “Pdf”, the bug is being reproduced with lowercase format value. So as a temporary workaround you can set capitalized format value. However, we will notify you when original issue is resolved.

$testformat = "Pdf";
$testoutpath = "testput.pdf";
$testdocument = fopen("C:/Temp/Test.ppt", 'r');
$testpassword = "password";
$testfontsfolder = null;
	
		
$request = new Aspose\Slides\Cloud\Sdk\Model\Requests\PutSlidesConvertRequest($testformat, $testoutpath, $testdocument, $testpassword, $testfontsfolder);
        
        	
$response = $slidesApi->putSlidesConvert($request);
print_r($response);

Perfect, “Pdf” is working for me.

Is there any way to convert a pptx without re-uploading it. Right now, I assemble by deck by merging slides and then save it on your server. Download the deck and then immediately re-upload it so I can download it as a PDF. It seems like you already have it on the server, and I should be able to download from the version saved on your server, without the extra upload.

@klubar

Thanks for your feedback. Yes, you can use PostSlidesSaveAs API to convert PPTX from storage to PDF and save to local drive.

curl -X POST "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/pdf" 
-H "accept: multipart/form-data" 
-H "authorization: Bearer [JWT_Access_Token]" 
-H "Content-Type: application/json" 
-d "{ \"Format\": \"pdf\"}" 
--output C:/Temp/MyPresentation.pdf

Thanks. Any chance in getting this added to the PHP SDK? I’m pretty much committed to using the SDK now, so switching (or having one piece) using CURL would be difficult.

@klubar

Thanks for your feedback. I am looking into your requirement and will update you shortly.

@klubar

Please note PostSlidesSaveAs method is already available in PHP SDK. Please check sample code snippet for your reference. Hopefully it will help you to accomplish the task.

Furthermore, in reference to your above reported issue in Question 2. We have fixed that issue in the latest release. Now your above code should work as well.

$format = "pdf";
$options = new Aspose\Slides\Cloud\Sdk\Model\ExportOptions();
$options->setFormat($format);

$testname = "ShapeInSlide.pptx";
$testformat = $format;
$testoptions = $options;
$testpassword = null;
$teststorage = null;
$testfolder = null;
$testfontsFolder = null;
	
	
$request = new Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesSaveAsRequest($testname, $testformat, $testoptions, $testpassword, $teststorage, $testfolder, $testfontsFolder);
			
$response = $slidesApi->PostSlidesSaveAs($request);

print_r($response);