Reputation: 5211
I am using Aspose Cells for .Net to convert Excel to PDF in Dot Net Core 3.1. It is perfectly working in local environment but when I hosted in AWS environment (AWS Lambda) it throws an error saying,
{"fileName":"System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory\n at Interop.Libdl.dlopen(String fileName, Int32 flag)\n at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()\n at System.Drawing.SafeNativeMethods.Gdip..cctor()\n --- End of inner exception stack trace ---\n at System.Drawing.SafeNativeMethods.Gdip.GdipNewPrivateFontCollection(IntPtr& fontCollection)\n at SelectPdf.Lib.ᡜ..ctor()\n.
I have referenced "System.Drawing.Common" DLL in my project to resolve this issue. But still this issue has not been resolved. How to resolve this issue?
Upvotes: 0
Views: 2775
Reputation: 1931
We tried the scenario for Aspose.Cells using Docker container assuming that “AWS Lambdas” is similar to docker container. We have tested this issue on Ubuntu 16.04 x64 in a docker container. Here are our steps:
The docker we used was: microsoft/dotnet, install it first: sudo docker pull microsoft/dotnet
Then, after running it straight away, we got the issue in this docker, We got the similar error upon saving to PDF. We did the following things to sort it out:
We installed 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
We found the PDF file was created successfully.
Also, see the thread for your reference which is helpful to use Aspose.Cells on AWS lambda environment.
PS. I am working as Support developer/ Evangelist at Aspose.
Upvotes: 3