Merge / Combine multiple PowerPoint Presentation Slides in PHP using Aspose.Slides REST API throwing OutofMemoryException

Aspose is throwing a System.OutOfMemoryException fatal error (see below)

The code that I’m using is as follows (in psuedo code)

  1. Create a presentation from a template
  2. create a “merge” array (in this case I’m merging from 21 different presentation to create a new presentation of 84 slides)
  3. execute “mergeslides” to combine all my source decks and slide into my new output presentation

This code works fine for smaller presentations, but throws out of memory when I get to production sizes

— Best solution for me is if there is a way of increasing the amount of memory on the Aspose side so this works

— Alternative is there a way to break the merge into multiple operations that will avoid the out of memory

If helpful I can PM the decks and code

Also – I’m using AWS for storage.

Thanks

Here is a smaller example that works

Success: PutPresentationMerge. Parameters: name ‘output_2020-06-06_12-43-46_u5edbc7c2b2bbf.pptx’, request ‘{“Presentations”:[{“Path”:“santander\S97.pptx”,“Slides”:[21]},{“Path”:“santander\S94.pptx”,“Slides”:[1]},{“Path”:“santander\S97.pptx”,“Slides”:[6,7,10,11,12,13,8,9,14,15,23,22]},{“Path”:“santander\S82.pptx”,“Slides”:[4,5,6,7]},{“Path”:“santander\S97.pptx”,“Slides”:[24,25,26,27]},{“Path”:“santander\S95.pptx”,“Slides”:[34,29,30,31,32,33]},{“Path”:“santander\S77.pptx”,“Slides”:[12,4,5]},{“Path”:“santander\S95.pptx”,“Slides”:[36]},{“Path”:“santander\S84.pptx”,“Slides”:[1,2,3]},{“Path”:“santander\S72.pptx”,“Slides”:[2,3,4,5,6]},{“Path”:“santander\S64.pptx”,“Slides”:[1,2]},{“Path”:“santander\S63.pptx”,“Slides”:[1,2]},{“Path”:“santander\S83.pptx”,“Slides”:[2,3,4]},{“Path”:“santander\S86.pptx”,“Slides”:[2,5,3,6]}]}’, storage ‘emiaws’, folder ‘finalDecks’.

But when I get to a larger production-sized presentation it throws the error

Error thrown:

Fatal error:  Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [400] Client error: `PUT https://api.aspose.cloud/v3.0/slides/output_2020-06-07_09-23-22_u5edcea4a8121e.pptx/merge?storage=emiaws&folder=finalDecks` resulted in a `400 Bad Request` response:
{"error":{"code":"error","message":"Exception of type 'System.OutOfMemoryException' was thrown.","description":"Operatio (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(16950): 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(16934): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->putPresentationMergeWithHttpInfo(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\PutPresentationMergeRequest))
#2 /var/www/emi/aspose/asposeFunctions.php(230): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->putPresentationMerge(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\PutPr in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 84

I’m also getting

Fatal error: Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [502] Server error: POST https://api.aspose.cloud/v3.0/slides/output_2020-06-07_12-32-05_u5edd16859410a.pptx/replaceText?oldValue=%25%25Meeting_description&newValue=introduction&folder=finalDecks&storage=emiaws resulted in a 502 Bad Gateway response:

502 Bad Gateway

502 Bad Gateway

(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(15444): 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(15428): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->postSlidesPresentationReplaceTextWithHttpInfo(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\PostSlidesPresentationReplaceTextRequest)) #2 /var/www/emi/aspose/asposeFunctions.php(44): Aspose\Slides\Cloud\Sd in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 84

On a slightly smaller presentation where the merge works, but I’m getting the error trying to PresentationReplaceText.

Is the 502 Bad Gateway a generic error for “too big” and how can I increase the maximum size?

Update on this issue …

I tried doing the merge after every 5 source presentations… I now get a get a 502 bad gateway after two success calls.

My calls now look like:

Success: PutPresentationMerge. Parameters: name ‘output_2020-06-07_11-00-48_u5edd012047888.pptx’, request ‘{“Presentations”:[{“Path”:“santander\S68.pptx”,“Slides”:[2]},{“Path”:“santander\S94.pptx”,“Slides”:[1]},{“Path”:“santander\S93.pptx”,“Slides”:[2,3,4,5,6,7,8,9,10,11,12,13]},{“Path”:“santander\S58.pptx”,“Slides”:[15]},{“Path”:“santander\S93.pptx”,“Slides”:[14,15,16]}]}’, storage ‘emiaws’, folder ‘finalDecks’.

For two calls (merging in 10 presentations) it worked fine; on the third merge I got the follow error thrown: (this is the same loop as above, so it’s exact the same call that I used above)

Warning: First parameter must either be an object or the name of an existing class in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 163

Fatal error: Uncaught Aspose\Slides\Cloud\Sdk\Api\ApiException: [502] Server error: GET https://api.aspose.cloud/v3.0/slides/output_2020-06-07_11-00-48_u5edd012047888.pptx/slides?folder=finalDecks&storage=emiaws resulted in a 502 Bad Gateway response:

502 Bad Gateway

502 Bad Gateway

(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(10237): 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(10221): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->getSlidesSlidesListWithHttpInfo(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\GetSlidesSlidesListRequest)) #2 /var/www/emi/aspose/asposeFunctions.php(249): Aspose\Slides\Cloud\Sdk\Api\SlidesApi->getSlidesSlidesList(Object(Aspose\Slides\Cloud\Sdk\Model\Requests\GetSlid in /var/www/emi/composer/vendor/aspose/slides-sdk-php/sdk/Api/ApiBase.php on line 84

How do I increase the size on the maximum size of the presentation?

@klubar

I’m afraid I’m unable to reproduce the issue. I have tried to merge 60 slides from 5 presentations, with number of calls I’m unable to reproduce the reported issue. We are further investigating the server logs. However, we will appreciate it if you please share your sample documents here. It will help us to address and investigate your issue exactly.

Sent you a private message with the source files.

@klubar

I’m afraid I’m unable to find the shared filed. Can you please share it again.

Meanwhile, I have tested the scenario with the files you shared in your other post. And unfortunately, I’m still unable to reproduce the issue.

{"Presentations":[{"Path":"Temp/S63.pptx","Slides":[1,2]},{"Path":"Temp/S64.pptx","Slides":[1,2]},{"Path":"Temp/S72.pptx","Slides":[1,2,3,4,5,6]},{"Path":"Temp/S77.pptx","Slides":[1,2,3,4,5,6,7,9,10,11,12]},{"Path":"Temp/S84.pptx","Slides":[1,2,3]},{"Path":"Temp/slide.pptx","Slides":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]},{"Path":"Temp/slide1.pptx","Slides":[1,2,3,4,5,6,7]}]}

I will try DMing you the link again. What information would be helpful in diagnosing this issue? It seems like my code works fine until the files get above a certain size. If there are known limits on the API calls or maximum file sizes it would be helpful to share them.

@klubar

We have logged a ticket SLIDESCLOUD-953 to further investigate the server logs and your pricing plan file size limit. Meanwhile, please share the source files again, shared in above private message to replicate the issue at our end as well.

Any updates? And what does 'pricing plan file size limit" mean? Are there different limits for different plans? I didn’t see that anywhere, but please let me know if I need a different plan that allows for larger documents.

@klubar

Thanks for your patience. We are investigating the issue with high priority and will share our findings soon. Yes, legacy pricing plans have different file size limits for different plan types. Aspose.Slides Cloud API supports maximum 100Mb request size.

As requested above please share the subjected PPTX documents as well.