We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells in AWS Lambda .NET Core 2.1 Function - Exception when saving to PDF

weeklyFlashReport.Save(inputStream, SaveFormat.Pdf);
buffer = inputStream.ToArray();
outputStream.Write(buffer, 0, buffer.Length);
try
{
Console.WriteLine(“Put object request starts”);
var putRequest = new Amazon.S3.Model.PutObjectRequest
{
BucketName = bucketName,
ContentType = “application/pdf”,
InputStream = outputStream,
Key = path,
CannedACL = S3CannedACL.PublicRead
};

                Console.WriteLine("Put Object request ends");

                Task<PutObjectResponse> response = client.PutObjectAsync(putRequest);

[Error] Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction: Unknown error responding to request: CellsException:
Aspose.Cells.CellsException: The type initializer for ’ ’ threw an exception.
at Aspose.Cells.Workbook.Save(Stream stream, SaveOptions saveOptions)
at AWSServerless_Report.Models.ViewReportModel.SaveSpreadSheetAsync(Workbook weeklyFlashReport, String FileFormat) in C:\MFR_Custom_QA\QA_API\API\AWSServerless_Report\Models\ViewReportModel.cs:line 1025

Please help me out asap.

Thanks.


This Topic is created by Amjad_Sahi using Email to Topic tool.

@aravin,

Thanks for providing us details.

Well, we did try this scenario for Aspose.Cells using Docker container assuming that “AWS Lambdas” is similar to docker container. We 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 (you need to do the same):

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 doing all these steps, the issue passed away, and the PDF file was created successfully.
Would you please check it and share the feedback.

where do i need to install this package?

I couldn’t able to find the package which you specified

@aravin,

Please take help on relevant external threads for reference.
e.g

Hi Amjad,

Is there any other way, were i could contact you to get the help regarding this in detail. I got strucked with this from yesterday.

Thanks in advance.

@aravin,

We do provide support via forums. We do not provide support via phone or any other sources. The best way to get help speedily is via forums, so you may use it.