Converting PPTX to HTML generated GDI+ error

I am using Aspose.Slides for .NET version 21.2.0.
When my system tried to convert pptx to html, the system generated error “a generic error occured in GDI+”.

Following is the exception detail:
Capture.JPG (28.5 KB)

I have also attached the sample slide I want to convert. (536.8 KB)

The code is very simple, just save it as html.


                // Save presentation to memory stream
                oFile.Save(stream, Aspose.Slides.Export.SaveFormat.Html);
                stream.Seek(0, SeekOrigin.Begin);

The problem occured in production server (windows server 2016), which is hardened.
The problem did not occur in my development server (windows server 2019).

The same issue actually happened when i convert PDF to html. So it has to be something with the convertion engine to html which caused the problem.

Is there any idea what caused the problem?
Does it require certain folders to access?

Why i wanted to convert to html, because I want to extract the text inside the slide.
If we cannot convert pptx to html, is there a way to convert pptx to text?

Welcome to our community! Thank you for posting the query. Unfortunately, I was unable to reproduce the exception on my side. It looks like the issue depends on a specific environment. Please check the problem using the latest version of Aspose.Slides. If the issue persists, please share and specify the following:

  • comprehensive code example (your code snippet contains unknown variables: oFile and stream)
  • .NET Framework version of Aspose.Slides assembly
  • any additional information that will help us to reproduce the exception

You should describe this issue on Aspose.PDF forum.

If the final writing is to a file, you should check the write permissions for the appropriate folder.

You can extract text from presentations as shown below:

foreach (var slide in presentation.Slides)
    foreach (var shape in slide.Shapes)
        if (shape is IAutoShape)
            var autoShape = (IAutoShape) shape;

Documents: Manage Text
API Reference: IAutoShape Interface

Thanks for the code. the code to get all the text from slide worked like a charm!

The oFile is basically the Aspose Presentation object. Stream is the memory stream.

I just wanted to show the error started from calling the Save method. Nothing fancy on my part. Just open the pptx and save it to the memory stream. The aspose dll will then generated the GDI error.

The error seemed to occur after my server team did server hardening. Before server hardening, everything is ok.

Since I only want to convert the slide to text, and your code worked very well, I don’t need to convert to html anymore and don’t care about GDI error anymore. So we can close this discussion.

Thank you again for the reply.