System.Drawing.Common issue on Windows

I have an ASP.NET Core 6 application I am trying to deploy.  We are using the SyncFusion FileFormat libraries to build and print Word docs, as well as convert them to PDF.  Upon deploying to a test region, I received an exception:

System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.

Now, I have done research enough to know and understand the message.  However, I am installing it on a Windows Server 2019 box running IIS.  There aren't any "non-Windows" environments anywhere in our organization.  I have each project set to target Windows, as we have no need for anything else.  I am at a


2 Replies

SB Sneha Biju Syncfusion Team November 24, 2023 11:58 AM UTC

Hi Joe,

We are setting the similar environment to replicate the reported issue at our end. We are planning to follow a similar approach(Windows 2019) as described in the documentation below, in the mentioned environment with the below code (Syncfusion Word to PDF related code)
https://help.syncfusion.com/file-formats/docio/convert-word-document-to-pdf-in-asp-net-core

We will update more details on 28th November, 2023.

In the meantime, if any additional manipulations are done at your end, kindly share the code snippet or the complete sample, along with the input document, with us. Also, please share the NuGet details used at your end. This will be helpful in reproducing the exact issue and providing more information as soon as possible.

Regards,
Sneha.



AA Akash Arul Syncfusion Team November 28, 2023 05:23 PM UTC

Joe, as we mentioned earlier, we set up the similar environment to replicate the reported issue at our end. We followed a similar approach(Windows 2019) as described in the documentation, in the mentioned environment with the Syncfusion Word to PDF related code and it is working fine at our end. 

We have attached the sample we tried at our end. We suggest you to modify the sample and share it with us. Also, please share the NuGet details used at your end. This will be helpful in reproducing the exact issue and providing more details at the earliest.


Attachment: ConvertWordDocumenttoPDF_9f73211b.zip

Loader.
Up arrow icon