Aspose.cells: saving excel to pdf don't work on docker container

I’m trying to export an XLSx file to pdf in a docker container (I’ve tried to run it on mcr.microsoft.com/dotnet/core/runtime:3.1.1:apine3.10 and mcr.microsoft.com/dotnet/core/runtime:3.1.1:nanoserver-1809) but I’m facing this error

error:
Unhandled exception. Aspose.Cells.CellsException: The type initializer for '♠   ' threw an exception.
   at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)
   at Aspose.Cells.Workbook.Save(String fileName, SaveFormat saveFormat)

when trying to
workbook.Save("invoice.pdf", SaveFormat.Pdf);

works well on my Windows machine with Excel installed.

any clues?

@GersonDias,
Thank you for your query.

I have tested this scenario on Ubuntu 16.04 x64, in a docker container.
Here are my steps:

The docker I use is: microsoft/dotnet, install it first:
sudo docker pull microsoft/dotnet

Then, after running it, if I run this issue in this docker, I get the error:

Aspose.Cells.CellsException : The type initializer for ‘???’ threw an exception.
at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)

It seems to be the same error you also get.

Then I install libgdiplus:

apt-get update
apt-get install -y libgdiplus
cd /usr/lib && ln -s libgdiplus.so gdiplus.dll

And install libc6-dev:
apt-get install -y --no-install-recommends libc6-dev

After all these steps, the issue passed, and the pdf file created successfully.
Would you please check it and share the feedback?

@GersonDias,

Aspose.Cells now also provides separate .NET6.0 and .NET7.0 libraries (in the release archive) that use SkiaSharp as the graphics library, as recommended in official statement of Microsoft. For more details about using Aspose.Cells with NET6, please see the document on how to use and run Aspose.Cells for .NET6.0. The procedure would be the same to work on .NET7.0.

We also recommend to try using latest version/fix: Aspose.Cells for .NET (Releases | NuGet).