Convert to PDF not working with .NET5 on Amazon Linux AMI

Hello Team,

We have been working with the Aspose.Cells v19.11.0 in .NET5.
We are trying to use the workbook.Save(ouputMemoryStream, SaveFormat.Pdf); method to convert Excel into PDF, however this fails with error 'The type initializer for '\u0005 ’ threw an exception."

The method runs fine on Windows, but fails on Amazon Linux AMI.
Looking from the other tickets, I see there is a support in .NET6 (Aspose Cells .NET6 saving workbook as PDF fails on Linux) but it requires to install ligdiplus which is not a supported package on Amazon Linux AMI (AWS | Amazon Linux AMI). ALso upgrading to .NET6 is not possible for us at this time, so we would like to know about any other library version which could support Excel to PDF with .NET5 on Amazon Linux AMI.

The following article states the same thing but that does not work

@mpadalia,

Please note, libgdiplus does not work well in linux. So, we migrated the graphics library to SkiaSharp recently especially for linux os. We suggest using .NET6 and upgrade to Aspose.Cells 22.10.1, See the document for your reference.

@Amjad_Sahi

Due to some other restrictions we are not able to upgrade our entire solution to .NET6, is there a way to make it work with .NET5?

@mpadalia,

Do you use Aspose.Cells for .NET Standard 2.0 Dll in .NET5.0 (apps) on Amazon Linux AMI?

@Amjad_Sahi
Yes exactly as you said

@mpadalia,

When you use Aspose.Cells for .NET Standard library, it requires libgdiplus to be installed on linux. Currently, there is no other reliable way to cope with it but to upgrade to .NET6.0 and latest version of Aspose.Cells for .NET.

@Amjad_Sahi

I tried a sample project with .NET6 and but I am not able to upgrade the Aspose.Cells package due to the following error ‘‘The subscription included in this license allows free upgrades until 15 Feb 2021, but this version of the product was released on 19 Oct 2022. Please renew the subscription or use a previous version of the product.’’

Without updating the Aspose.Cells package and just updating to .NET6 I am still facing the type initializer error.

@mpadalia,

As the error denotes, your current license cannot use latest versions of the APIs. You need to upgrade your subscription to use latest version or (upcoming) newer versions of the APIs.