PPTX to PDF Conversion in C# Generates "A Generic Error Occurred in GDI+" Error

When PPT is converted to PDF we get an error called generic error in GDI+. Attached are the PPT document. PDF is not getting generated
GDIIssue.zip (834.0 KB)

@lpappachen I apologize for the inconvenience, but I was unable to reproduce the issue you mentioned. I successfully created the PDF file based on the presentation you provided.

I am currently using the latest version of the Aspose.Slides API (v23.5) and the following code:

Presentation presentation = new Presentation("C:\\Temp\\slides\\input.pptx");

var saveOpt = new Aspose.Slides.Export.PdfOptions() {
    EmbedFullFonts = true,
    EmbedTrueTypeFontsForASCII = true,
};

// Saves the presentation as a PDF
presentation.Save("C:\\Temp\\output.pdf", Aspose.Slides.Export.SaveFormat.Pdf, saveOpt);

If there are any specific steps or additional information you can provide to help replicate the problem, please let me know.
output.zip (8.3 MB)

What could be the reason this issue happens? Even in our environment it changes ocasionally on what document causes the issue

@lpappachen that error can be challenging to solve. Please note that this specific exception is not an internal exception of the Aspose.Slides API. When GDI+ is unable to save files, it throws an error, which can be caused by various reasons such as a non-existent file path, file blocking, missing permissions, and so on. Could you please provide the stack trace of your exception so that we can investigate its origin?

The file that caused issue was PPT. You specified aspose.words api was that a typo?

@lpappachen yes, that was a typo. Sorry for the confusion, I’ll fix it.

Hello,

Please find the stack trace for this issue:

System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+. at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) at Aspose.Slides. ? .(Image , Stream , Single , Single ) at Aspose.Slides. ? .(Stream , ? ) at Aspose.Slides. ? .( ? , ?? ) at Aspose.Slides.?? .( ? , ? ) at Aspose.Slides. ? .( ? , Boolean ) at Aspose.Slides.?? .(? ) at Aspose.Slides.?? .dcmwnbu9vqkgf3raakpgez2padkxnqpr (? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides. .( , ?? ) at Aspose.Slides.?? .( , ?? ) at Aspose.Slides. .(Presentation , Stream , Int32[] , PdfOptions , InterruptionToken ) at Aspose.Slides. .(Presentation , Stream , PdfOptions , InterruptionToken ) at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options) at Aspose.Slides.Presentation.Save(String fname, SaveFormat format, ISaveOptions options)

@lpappachen,
I was also unable to reproduce the exception on my end. Please also share the following additional information if it is possible:

  • OS version on which the conversion was performed
  • .NET target platform in your app
  • Aspose.Slides version you used

Hello,

Please find below details as asked.

1. OS version on which the conversion was performed

Edition Windows 10 Enterprise
Version 21H2
OS build 19044.2486
Experience Windows Feature Experience Pack 120.2212.4190.0

2. .NET target platform in your app
.Net Framework 4.8

3. Aspose.Slides version:
23.5 (also tried with 23.6)

@lpappachen,
I apologize for the inconvenience, but I haven’t been able to replicate the exception you mentioned. Could you please attempt to isolate the error and provide us with more details about your environment? This will help us investigate the issue further on our end.

The exception we provided does that not give sufficient information on why the error happened? What exactly do you want us to isolate?

@lpappachen,
We were unable to reproduce the exception on our end. We kindly request additional information on the steps or conditions necessary to reproduce it.