Aspose.Net Total on Lambda (using .Net Core 2.1)

Hi,

We’ve just plugged in Words, Cells and Slides into one of our AWS Lambdas - so that we can generate PDFs for various files.

Words appears to be working ok.
However, Cells and Slides are both hitting exceptions during the “Save” method (when converting to PDF).

Slides: One or more errors occurred. (The type initializer for ‘Gdip’ threw an exception.): AggregateException
Cells: One or more errors occurred. (The type initializer for ' ’ threw an exception.): AggregateException

Are there dependencies which need to be include in the C# project?
Are the any other work-arounds for this?

Cheers,
Tom

@tomrichardsredington

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Excel and PowerPoint documents.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

I’ve attached an example Excel and Powerpoint file

Test.zip (40.0 KB)

using (var convertedStream = new MemoryStream())
{
    var aspose = new Presentation(stream);
    aspose.Save(convertedStream, Aspose.Slides.Export.SaveFormat.Pdf);
    convertedStream.Position = 0;
    return convertedStream.ToArray();
}

(we do somethng similar using Cells / Workbook).

Cheers,
Tom

@tomrichardsredington

For Powerpoint document, we have logged this problem in our issue tracking system as SLIDESNET-41344. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Regarding Excel to PDF conversion, we are working over this issue and will get back to you soon.

@tomrichardsredington

Regarding Excel to PDF conversion, we have logged this problem in our issue tracking system as CELLSNETCORE-31. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tomrichardsredington,
We have tried this scenario for Aspose.Cells using Docker container assuming that “AWS Lambdas” is similar to docker container. Please confirm if this is true or not? Also share if same process resolves issue for Aspose.Slides?

I have tested this issue 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?