Getting a com.aspose.slides.PptUnsupportedFormatException exception while trying to load a PPT from resources in my WebApplication

Hi,


I am getting an error while trying to load a PPTX file from my we application (File attached). It is a Spring application and the code inside my controller is something like given below :


...
...
final InputStream licenseStream = DemoController.class.getClassLoader()
					.getResourceAsStream("Aspose.Slides.lic");

// Instantiate the License class
final License license = new License();

// Set the license through the stream object
license.setLicense(licenseStream);

final InputStream templateStream = DemoController.class.getClassLoader()
					.getResourceAsStream("ppt2.pptx");

final Presentation prez = new Presentation(templateStream); // Gets Error Here
...
...

However, when I try to run the sam code as a standalone Java App - it runs fine. What could be wrong here? Any help will be greatly appreciated.


UPDATE: I tried with both Aspose Slides Version 15.11.0 and 16.1.0 but am getting the same error.

Regards,
-A.

Hi,

I have observed the issue shared by you. Since presentation is getting loaded in normal Java application so it can be concluded there is no issue in API while loading presentation. I request you to please first try using a simplest code in your web application for loading the presentation. You can try loading the presentation from disk and if it succeed then you can try using standard InputStream to load the presentation. It seems to be an issue with presentation getting loaded using stream used on your end. If the issue still persist then please share the working sample project so that I may try that on my end to help you further.

Many Thanks,

Hi Mudassir,


Thanks for responding to my query. As mentioned in the original post, the API was working fine in a standalone setup but was failing on the webapp setup.
I figured out the issue, the maven resources plugin was filtering the pptx files while copying the same from resources folder to the WEB-INF/classes.
Adding the file to the ignored list resolved the issue.
Thanks once again.

Regards,
-A
Hi,

Thank you for your valuable feedback.

We are glad to know that your issue is resolved and things have started working on your end.

Please feel free to contact us if we could be of any help to you.

Best Regards,