Free Support Forum -

Convert Microsoft PowerPoint Presentation to PDF in PHP using Aspose.Slides REST API throwing 400 Bad Request

The code I’m using hasn’t been touched in a long time and was previously working. Has there been any changes to the api?

Here is a link to the file I’m trying to save as PDF

Here is the error message that is being thrown:

Fatal error* : Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [400] Client error: POST resulted in a 400 Bad Request response: {“error”:{“code”:“error”,“message”:“Incorrect Content-Type: application/octet-stream,multipart/form-data”,“description”: (truncated…) in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php:84 Stack trace: #0 /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(14338): Aspose\Slides\Cloud\Sdk\Api\ApiBase->httpCall(Object(GuzzleHttp\Psr7\Request)) #1 /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/SlidesApi.php(14322): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->postSlidesConvertWithHttpInfo(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesConvertRequest)) #2 /var/www/emi/aspose/asposeFunctions.php(178): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->postSlidesConvert(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesConvertRequest)) #3 /var/www/emi/aspose/uploadPresentation.php(51): aspConver in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 84

And here is my request:

Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesConvertRequest Object
[format] => Pdf
[document] => SplFileObject Object
[pathName:SplFileInfo:private] => /tmp/phprna7zS
[fileName:SplFileInfo:private] => phprna7zS
[openMode:SplFileObject:private] => r
[delimiter:SplFileObject:private] => ,
[enclosure:SplFileObject:private] => "

[password] => 
[fontsFolder] => 


Is there any more information that would be helpful in diagnosing this issue?


We are sorry for the confusion. May be it has been changed at the start of API Version V3 launch. Please note you need to use only multipart/form-data content type instead of both application/octet-stream,multipart/form-data in PostSlidesConvert API Method.

curl -X POST "" 
-H "accept: multipart/form-data" 
-H "authorization: Bearer [Access_Token]" 
-H "Content-Type: multipart/form-data" 
-H "x-aspose-client: Containerize.Swagger" 
-F "File=@C:/Temp/KL P3 Pitchbook_FX_FINAL_compressed.pptx" --output C:/Temp/test.pdf

Updating the PHP API from github seems to have fixed the problem. Thanks for the hint!

1 Like