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.

Wed Dec 04, 2024 5:21 am

Hello,

when converting Html to Word using FreeSpire.Doc in a linux environment using .Net 7, the library throws exception of System.Drawing. It is working fine on Windows based Systems.

Is there any workaround or fix for this?

Thanks

harsh752
 
Posts: 2
Joined: Wed Dec 04, 2024 5:15 am

Wed Dec 04, 2024 6:42 am

Hello,

Thanks for your inquiry.

For Linux systems, please use our .NETStandard2.0 DLL.

When searching for and installing FreeSpire.Doc via NuGet, the default installation is the .NET 6.0 DLL, which has a dependency on System.Drawing.Common.
Therefore, I recommend that you install our commercial version of Spire.Doc for .NETStandard DLLs via NuGet:
https://www.nuget.org/packages/Spire.Docfor.NETStandard/12.11.7
We can provide you with a one-month temporary license to help you evaluate our product without any watermarks or restrictions.

Alternatively, you can also download FreeSpire.Doc from our website. After installation, you will obtain the .NETStandard DLL locally, and you can manually add the DLLs under .NETStandard 2.0 to your project as well. Make sure to also include any necessary dependent DLLs that come with the .NETStandard 2.0 package.
Code: Select all
netstandard2.0   Has external reference to    
SkiaSharp >= 2.80.0
System.Buffers >= 4.5.1
System.Memory >= 4.5.5
Microsoft.Win32.Registry >= 4.5.0
System.Text.Encoding.CodePages >= 4.5.0
System.Security.Cryptography.Pkcs >= 4.5.0
System.Security.Cryptography.Xml >=4.5.0
System.Security.Permissions >= 4.5.0
HarfBuzzSharp >=2.6.1.5


Friendly Reminder:
Spire.Doc for Free version is limited to 500 paragraphs and 25 tables. This limitation is enforced during reading or writing files. When converting word documents to PDF and XPS files, you can only get the first 3 page of PDF file. Upgrade to Commercial Edition of Spire.Doc.We don't provide technical or any other support to the users of the free versions.



If you have any questions or need further assistance, please do not hesitate to contact us.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3008
Joined: Wed Jun 27, 2012 8:50 am

Wed Dec 04, 2024 1:36 pm

Hello, I have installed the .NETStandard2.0 DLL and it works on linux. But, when converting html to docx with an image, all images appear as a red cross on linux. They appear correctly on windows.

Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(htmlFile, Spire.Doc.FileFormat.Html, Spire.Doc.Documents.XHTMLValidationType.None);
document.HtmlExportOptions.ImageEmbedded = true;


MemoryStream memoryStream = new();
document.SaveToStream(memoryStream, Spire.Doc.FileFormat.Docx);

my html file is attached below along with the windows and linux output docx files.

harsh752
 
Posts: 2
Joined: Wed Dec 04, 2024 5:15 am

Thu Dec 05, 2024 2:54 am

Hello,

Thanks for your feedback.

I was able to reproduce the issue you encountered using Free Spire.Doc 12.2.0. However, when I tested with the commercial version 12.11.7, the problem does not occur.

I recommend that you update to version 12.11.7 via NuGet: https://www.nuget.org/packages/Spire.Docfor.NETStandard/12.11.7.

We can provide you with a one-month temporary license to help you evaluate our product without any watermarks or restrictions. Please let me know if you need it.

I am looking forward to hear from you soon.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3008
Joined: Wed Jun 27, 2012 8:50 am

Tue Dec 10, 2024 3:52 am

Hello,

Hope you are doing well.

May I ask that you have tried version:12.11.7? Has your issue been solved?

I'm looking forward to receiving your feedback soon.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3008
Joined: Wed Jun 27, 2012 8:50 am

Fri Dec 20, 2024 7:21 am

Hi,

we face similar issue, spire.doc not working on ubuntu 22.04 vm but working on windows server.

as you suggested we are using licensed version spire.doc 12.11.7, so please advise.

System.TypeInitializationException
The type initializer for 'Gdip' threw an exception. System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms

Regards

eman.alqahtani
 
Posts: 1
Joined: Tue Oct 29, 2024 1:21 pm

Fri Dec 20, 2024 8:12 am

Hello,

Thank you for your inquiry.

When installing our product via NuGet on a Windows system, the default installation is the Spire.Doc for .NET 6.0 DLL. Typically, this should not result in the exception "System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms."

To assist us in investigating the cause, please provide the following detailed information:
1. The exact version number of the Spire.Doc.dll installed in your project, for example, 12.11.7.3360.
2. The type of your application, such as Console Application.
3. Your system environment, for example, Windows 10 64-bit.

Thank you for your assistance!

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3008
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc