Aspose PDF error: ‘Gdip’ threw an exception with Dotnet Core 3.x app on Mac OSX

Viewed 2116

I am running a Dotnet core app (3.1) on a Mac (Catalina) and I’m trying to add an image to a PDF using Aspose PDF with this tutorial: https://docs.aspose.com/pdf/net/manipulate-images/.

I get an error when trying to add the imageStream.

"Invalid image stream (The type initializer for ‘Gdip’ threw an exception.)’.

var logoFile = "logo.jpg";
FileStream imageStream = new FileStream(logoFile, FileMode.Open, FileAccess.Read);
page.Resources.Images.Add(imageStream); //Error on this line

Doing my research, this appears to be related to needing the libgdiplus library. I installed this with brew install mono-libgdiplus but I am still getting this error.

Sample Project that can replicate the issue: https://github.com/duyn9uyen/aspose-add-image-to-pdf.

Aspose.Pdf: Version=“20.3.0”.

Can someone help?

1 Answers
Related