I’m currently trying to create presentation out of a AWS Lambda function. Unfortunately, during the initialization of Aspose.Slides, a Exception is thrown:
One or more errors occurred. (The type initializer for ‘Gdip’ threw an exception.): AggregateException
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
at .( , IPresentation )
at .(IPresentation , Stream , PresentationTypeEx , IPptxOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at serverless_pptexporter_processor_csharp.Function.FunctionHandler(String input, ILambdaContext context) in C:\Users\Max\source\repos\ppt\ppt\Function.cs:line 54
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: DllNotFoundException
at Interop.Libdl.dlopen(String fileName, Int32 flag)
at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()
at System.Drawing.SafeNativeMethods.Gdip…cctor()
It looks like the dependency “Libdl” is missing or can’t be found in this linux environment. I’ve already added the NuGet package “System.Drawing.Common” to my project, but this didn’t help.
I have observed the issue shared by you and request you to please provide the sample project and source presentation (if any) that is reproducing the issue on your end. We will be able to investigate the issue further on our end on provision of requested information.
Attached is the sample VS project. The source code is very simple:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
using Aspose.Slides;
using Aspose.Slides.Export;
// Assembly attribute to enable the Lambda function’s JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
namespace AsposeSlides_AWSLambda_CSharp
{
public class Function
{
Thank you sharing the information. An issue with ID SLIDESNET-41073 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.
Please let me know, as soon as you know, if this is a issue that has to be fixed on your end or if it is just a configuration problem. I’d like to order the paid version of Aspose.Slides but this requirements is mandatory for me. If it`s a bug and takes some time, I’m probably have to choose another tool or the Java version of Aspose. However, I’d prefer to use the C# version of Aspose.Slides. Thank you
I have verified from our issue tracking system and regret to share that at present the issue is unresolved. We request for your patience till the time the issue gets resolved. We will share notification with you as soon as the issue will be fixed.
I have observed your comments. Actually, the concerned issue associated with this thread is unresolved. We request for your patience and will share the good news with you as soon as the issue will be fixed.
Actually, Aspose.Slides depends internally on the GDI+ graphics library. Microsoft has released System.Drawing.Common NuGet package to provide cross-platform access for the GDI+ graphics functionality via declaring .NET Standard conformed API (essentially, GDI+ is a built-in library for Windows, but this is not always true for other Linux-based distributions). The System.Drawing.Common package (which referenced in the project), despite its cross-platform nature and the presence of additional .dll libraries in the project, have external dependencies, which are usually absent in Linux. Such dependencies must be installed separately.
Therefore, each AWS Lambda instance is a container created from Amazon Linux AMIs (see reference). Linux distribution related to RHEL, and to be able to use GDI+ functionality in the RHEL environment, the following packages must be installed:
glibc-devel, libgdiplus fnd libX11-devel
For creating AWS Lambda Layers you can reference this link. To create a package with additional native packages, please visit this link.
Please note that using Aspose.Slides in AWS Lambda Function may not be a very good idea, since AWS Lambda has limitations on the resources used. A better solution may be to use AWS Lambda in conjunction with ECS. Please see this web reference link (https://aws.amazon.com/blogs/compute/better-together-amazon-ecs-and-aws-lambda) for your convenience as well.
Hi, I have tried a few layer configurations but without success. My company is in the process of purchasing the developer license - could we potentially ask you to provide a ready Lambda layer through paid support?
I tried using a layer I discovered here: GitHub - rv-dtomaz/lambda-layer-system-drawing. This layer has the required libgdiplus but I still get the “Unable to load shared library ‘libgdiplus’ or one of its dependencies” error. I presume the layer is still missing a dependency. I’m trying to figure out how to install those dependencies and make my own layer, but was hoping there might be a ready-made layer (just a .zip) you could provide.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.