Converting PPTX to PDF in C# Throws PptxReadException

I,m trying to convert pptx file ( in edited1.zip by Roger_Wood) to pdf using Aspose.Slides for .NET 22.5 with license and Aspose.Slides for .NET 22.6 without license on Linux and i get Aspose.Slides.PptxReadException: The type initializer for ‘Gdip’ threw an exception in both versions.
asposeSlidesException.jpg (208.2 KB)

@AlexMakarov,
Unfortunately, the notification that the issue has been resolved was sent in error. Our developers have not managed to reproduce the exception. Please share the following information:

  • code example that reproduces the error
  • OS version/distribution where the code was executed
  • .NET target platform in your app
  • any other additional information about your environment

We will then check the issue in an environment similar to yours.

  • code example that reproduces the error
using Aspose.Slides;

namespace tst
{
  internal class Program
  {
    static void Main(string[] args)
    {
      var presentationPaths = new string[] { "edited1.pptx", "edited2.pptx", "common.pptx" };

      foreach (var path in presentationPaths)
      {
        Presentation presentation = new Presentation(path);
        presentation.Save($"{path}.pdf", Aspose.Slides.Export.SaveFormat.Pdf);
      }
    }
  }
}
  • OS version/distribution where the code was executed
    Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-120-generic x86_64)
  • .NET target platform
    netcoreapp3.1.420
  • presentations presentations.zip (958.6 KB)

@AlexMakarov,
Thank you for the additional information. You should install libgdiplus on Linux systems before using Aspose.Slides. It should help you.

Documents: Installation

libgdiplus already installed

apt show libgdiplus
Package: libgdiplus
Version: 6.0.4+dfsg-2
Priority: optional
Section: universe/libs
Origin: Ubuntu
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: Debian Mono Group pkg-mono-group@lists.alioth.debian.org
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 558 kB
Depends: libc6 (>= 2.29), libcairo2 (>= 1.10.0), libexif12 (>= 0.6.21-1~), libfontconfig1 (>= 2.12.6), libfreetype6 (>= 2.2.1), libgif7 (>= 5.1), libglib2.0-0 (>= 2.31.8), libjpeg8 (>= 8c), libpng16-16 (>= 1.6.2-1), libtiff5 (>= 4.0.3), libx11-6
Homepage: http://www.mono-project.com/Libgdiplus
Download-Size: 160 kB
APT-Sources: http://ru.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: interface library for System.Drawing of Mono
This package contains a GDI+ API compatible implementation needed by the
System.Drawing library of Mono.

@AlexMakarov,
I’ve added a ticket with ID SLIDESNET-43356 to our issue tracking system. Our development team will investigate the case. We will inform you of any progress.

1 Like

@AlexMakarov,
Unfortunately, our developers have not managed to reproduce the error you encountered. Could you please share a C# project to reproduce the exception?

tst.zip (2.2 MB)

@AlexMakarov,
Thank you for the sample project. I’ve forwarded it to our developers.

1 Like

@AlexMakarov,
Our developers have investigated the case. Your mistake is that you explicitly included the System.Drawing.Common version 6.0 package in the project. This version, unlike the previous ones, works only on the Windows platform:

The fixed solution: tst_fixed.zip (2.2 MB)

1 Like

Is this issue resolved?

@rakesnayak2007,
Yes, the issue is solved by excluding System.Drawing.Common from the project.