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

Free Support Forum - aspose.com

Aspose.PDF.Document throws "The type initializer for 'Gdip' threw exception"

While trying to generate PDF with html string we get the exception:
The type initializer for ‘Gdip’ threw exception
It was mentioned that it is fixed in version 22.6, we have 22.12 (Skia 2.88.3)

new Aspose.Pdf.Document(
    new MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlText)), 
    new Aspose.Pdf.HtmlLoadOptions (ResourcesDirectoryPath)

On windows that code works perfectly.

Need urgent help and/or workaround (we bought new license for new version and new version looks broken).

Aspose.PDF 22.12.0
SkiaSharp 2.88.3
.NET 6.0
OS: Ubuntu 20.04


Aspose.PDF.Drawing NuGet package was released, DLL in this package doesn’t have System.Drawing.Common dependency.

You only need to install Aspose.PDF.Drawing instead of Aspose.PDF. Aspsoe.PDF with Drawing contains Aspose.Drawing inside, installing neither System.Drawing nor Aspose.Drawing is required.

This assembly correctly works under Linux environment. It will be published as separated assembly until we sure that this works absolutely perfect and may replace current System.Drawing-based assembly by 100%. When we ensure that, we will replace System.Drawing version with Aspose.Drawing one.

Thank you for your response. Including Aspose.PDF.Drawing did the trick.

But question remains for Aspose.Slides.NET. What library shoud be used instead? (Aspose.Slides gives the same “Gdip” error and uses System.Drawing)


As for Aspose.Slides related query, we request you please create a topic in respective forum category where you will be assisted accordingly.