Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Apr 14, 2026 2:29 pm

Hi, I have been working on a project that uses Spire.Doc to convert docx document to PDF. Whenever there is any form of shapes, tables or images, It will fail with the good old "System.TypeInitializationException: The type initializer for 'Gdip' threw an exception". It is likely because dotnet does not have System.Drawing.Common support on Mac and hence the error. In our case, we can choose what word documents to use for the app and the way we make it work at the moment is by not having objects that requires "drawing" in the word document and somehow make it work. This obviously isn't the best solution of all time, it can get tedious if documents with more complicated structure is involved. So I am wondering if there is any official reliable way to convert docx to pdf on Mac. By that I mean it sort of works but not when there are objects like tables and images. Since it does not work on Mac, I doubt it will work on Linux. To give to a clearer picture, these are the versions, platforms in use and what I have tried.

Local Development Device: Mac mini M1, Macbook Air
Dotnet Version: 8
Spire Doc Version: 13.5.11
Spire PDF Version: 11.7.10

We have paid license.

Already has all the custom fonts loaded.

Fails even if it is a blank document with a blank table in it.

Where it fails: document.SaveToStream(pdfStream, FileFormat.PDF);

Tried setting ToPdfParameterList:
ToPdfParameterList tpl = new ToPdfParameterList { UsePSCoversion = true };
document.SaveToStream(pdfStream, tpl);

Tried `brew install mono-libgdiplus`

eddywiz2026
 
Posts: 2
Joined: Tue Apr 14, 2026 1:59 pm

Wed Apr 15, 2026 3:04 am

Hello,

Thanks for your inquiry.
Due to Microsoft's did the adjustment for System.Drawing from Net6.0 for Lunix system. In order to adapt to this adjustment, you can install our Spire.Docfor.NETStandard 13.5.11 and Spire.PDFfor.NETStandard 11.7.10 via Nuget, it only contains the netstandard2.0 dlls and relies on the SkiaSharp, and add "SkiaSharp.NativeAssets.Linux.NoDependencies" to the project simultaneously to test again. If there is any other issues, just feel free to write back.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Wed Apr 15, 2026 4:11 am

Hi, thank you for the swift response. This solved the problem. I only had a rough idea of needing to make it use SkiaSharp but wasn't sure how. Is the part where installing SkiaSharp.NativeAssets.Linux.NoDependencies included in the documentation anywhere? I might have missed it. Also, is this dependency included in newer versions?

eddywiz2026
 
Posts: 2
Joined: Tue Apr 14, 2026 1:59 pm

Wed Apr 15, 2026 4:20 am

Hello,

Thank you for your feedback.
The "SkiaSharp.NativeAssets.Linux.NoDependencies" requires you to install separately. Sometimes, there may be exceptions if you don't install it. Therefore, it is recommended to test after installation.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc

cron