Aspose.Slides.Presentation Throws “The Type Initializer for ‘Gdip’ Threw Exception”

I was redirected to this subforum from Aspose.PDF, where similar problem took place, but was solved by linking another library (Aspose.PDF.Document throws "The type initializer for 'Gdip' threw exception"). But now we need solution for Slides.

While trying to generate PDF with PPT we get the exception:
The type initializer for ‘Gdip’ threw exception

var loadOptions = new Aspose.Slides.LoadOptions();
loadOptions.LoadFormat = LoadFormat.Ppt;
var presentation = new Aspose.Slides.Presentation(filePath, loadOptions);
presentation.Save (newPath, Aspose.Slides.Export.SaveFormat.Pdf); // <-- error "Gdip" line

On windows that code works perfectly. Supposedly, error occurs because of “System.Drawing” usage, instead of Aspose.Drawing in Slides.

Need help and/or workaround.

Aspose.Slides 22.12.0
.NET 6.0
OS: Ubuntu 20.04

@SergTomcat,
Thank you for describing the issue. Please share the following additional data:

  • simple project that reproduces the error
  • full stack trace of the error

@Andrey_Potapov, here is the sample project:
https://websoft365-my.sharepoint.com/:u:/g/personal/kotoff_websoft_ru/EXTW-CzUlcZGo5GkbJOoUBABAJE9MXRSJusJkq_aqkX6iw?e=bbR6dh

Code in “\ConsoleApp1\ConsoleApp1\Program.cs”
Builded executable for Linux in “\ConsoleApp1\ConsoleApp1\bin\Debug\net6.0\ubuntu.16.04-x64\ConsoleApp1”

Full stack trace:

wt@ubuntu1604docker:~/temp/ubuntu.16.04-x64$ ./ConsoleApp1
./ConsoleApp1
Unhandled exception. System.TypeInitializationException: The type initializer for ‘Gdip’ threw an exception.
—> System.DllNotFoundException: Unable to load shared library ‘libgdiplus’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip…cctor()
— End of inner exception stack trace —
at System.Drawing.SafeNativeMethods.Gdip.GdipStringFormatGetGenericTypographic(IntPtr& format)
at System.Drawing.StringFormat.get_GenericTypographic()
at tor(Bitmap )
at …ctor(Int32 , Int32 , Single , Single, Boolean , Boolean , , List1 ) at Aspose.Slides.Slide.(Boolean , ,ist1, InterruptionToken )
atresentation , Stream , Int32[] , PdfOptions, InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at Program.$(String[] args) in C:\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 11
Aborted (core dumped)

Looking forward for a solution, as time is running out.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-43747

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Any update on SLIDESNET-43747? I am facing similar issue on latest version of Aspose slide.

@prorigo,
The issue is still open. Unfortunately, I don’t have any additional information yet.