Free Support Forum -

Search media files and check its size in PPTX

Hello Team,

We are using Aspose slides Java version:8.6.0

We have a requirement to block upload of pptx with huge media files.

Is it possible to recognize the media files in pptx and check the size of these media files so that we can block the pptx upload? Please provide solution for this requirement.

Thank you for the query. It will take me a while to prepare the information for you. I will answer as soon as possible.

You can check the size of the media files as shown below:

var presentation = new Presentation(filePath);

for (var image : presentation.getImages())
   var imageSize = image.getBinaryData().length;
   // check the image size here

for (var audio : presentation.getAudios())
   var audioSize = audio.getBinaryData().length;

   // check the audio size here

for (var video : presentation.getVideos())
   var videoSize =  video.getBinaryData().length;

   // check the video size here

I recommend you to use the latest version of Aspose.Slides.

Documents: Shape Types
API Reference: IPresentation interface

1 Like