We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Generating and uploading slides to Amazon S3 using streams

I’d like to generate presentations and upload them to Amazon S3, all using streams. The presentation building operation would be performed on an AWS Lambda function, where it isn’t an option to save the generated presentation to disk before uploading.

For instance, in this example code, instead of reading the video file from disk and writing the generated file to disk, I’d like to read the video from an S3 object and write the generated presentation as another S3 object.

My understanding is that this should be theoretically possible, since the Presentation constructor accepts a stream of type InputStream to read from, and the save() method can write to a stream of type OutputStream.

However, theres’ a catch when using streams to upload to S3: the upload request must specify the content length in the upload metadata. Is it possible to know the content length for the presentation being saved beforehand?

I’d also appreciate your insights on this whole idea, and whether doing this on AWS Lambda is a good idea to begin with.

Thanks in advance!


I have observed your requirements and like to share that as far as Aspose.Slides is concerned, it does allow reading the presentation file from stream and writing it back to stream as well. This shall serve your requirement.

For your second requirement concerning to content length, you can convert the stream to byte array on run-time and get the length too. I hope the share elaboration will be helpful.

Thanks for your response. Converting a stream to a byte array would load the entire file into memory. This is fine for operations where the size of the generated files are a few megabytes in size, but we may be dealing with presentations with large embedded videos, in which case that’s not ideal. I guess we’ll have to find another way to calculate file size, since AWS Lambda provides limited disk space (~300MB).


Thank you for sharing the feedback. Please feel free to share any issue incurring owing to Aspose.Slides.