Free Support Forum - aspose.com

Detecting if Aspose.Slides can handle a stream (C# . NET)

Hi there,

We are currently trying to outline a strategy for detecting the Aspose component (starting from Detect file types from stream) that could handle a stream based on utilities function like:

                var fileFormatInfo = Aspose.Cells.FileFormatUtil.DetectFileFormat(input);
                if (fileFormatInfo.LoadFormat != Aspose.Cells.LoadFormat.Unknown)
                {
                    canHandle = true;
                }

Aspose.Slides.NET 20.2.0 does not have such utilities functions and we currently use this piece of code:

                    var canHandle = false;
                    try
                    {
                        input.Position = 0L;

                        var loadOptions = new Aspose.Slides.LoadOptions()
                        {
                            OnlyLoadDocumentProperties = true
                        };

                        using (var presentation = new Aspose.Slides.Presentation(input, loadOptions))
                        {
                            presentation.Dispose();
                        };

                        canHandle = true;
                    }
                    catch (Exception)
                    {
                    }

This is not ideal and we were wondering if there are other ways to check this with the latest of Aspose.Slides similar to utilities like Aspose.Words.FileFormatUtil.DetectFileFormat(input) or even the Aspose.CAD.Image.CanLoad(input)?

Thank you!

@gwert,

I have observed your requirements and have created an issue with ID SLIDESNET-41836 in our issue tracking system as new feature request to provide requested support. This thread has been linked with the issue so that you may be notified once the feature will be available.