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 Aug 07, 2019 7:50 am

I am trying to make a ProofOfConcept Azure function that converts a Word document to Pdf, however I keep running into System.Drawing errors.

Is this scenario supported or not?

System.PlatformNotSupportedException: System.Drawing is not supported on this platform.
at System.Drawing.Text.PrivateFontCollection..ctor()
at sprᬁ..ctor(sprᬔ A_0, SizeF A_1, Graphics A_2)
at spr᫹.ᜓ()
at spr᫹.ᜀ(IDocument A_0)
at sprᬤ.ᜀ(Document A_0, Stream A_1, ToPdfParameterList A_2)
at Spire.Doc.Document.ᜀ(Stream A_0, ToPdfParameterList A_1)
at Spire.Doc.Document.SaveToStream(Stream stream, ToPdfParameterList paramList)
at AzurePdf.CreatePdf.Run(HttpRequestMessage req, TraceWriter log) in

dinden
 
Posts: 16
Joined: Wed Aug 07, 2019 7:42 am

Wed Aug 07, 2019 8:54 am

Hi,

Thanks for your inquiry.
When using Azure function, here is a specific version. Please download it from following link:
http://www.e-iceblue.com/downloads/Temp ... pdfsk2.zip

After adding Spire.Doc into project, you need to add SkiaSharp Version 1.60.0 and System.text.encoding.codepages version 4.0.1. Note the version must be the same as I mentioned. Then please copy the two dlls(libSkiaSharp.dll and System.Text.Encoding.CodePages.dll) in the folder like "yourProject\bin\Debug\netstandard2.0\bin".

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Aug 07, 2019 10:28 am

ok, that works, but seems like a very manual solution (and does not allow me to update the Spire version to the latest).
Will this be resolved in the near future?

I tried the same code on a V1 Azure Function (using .Net Framework 4.7.2), which ran fine without any manual intervention.

dinden
 
Posts: 16
Joined: Wed Aug 07, 2019 7:42 am

Thu Aug 08, 2019 2:41 am

Hi,

We will update the version synchronously on NuGet in the future. Then there is no need to add it manually in your project, and you could use the latest version.
Once the version is updated on NuGet, I will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Aug 19, 2019 9:24 am

Hi,

Hope you are doing well.
Glad to inform you we published Spire.Doc Pack(hot fix) Version:7.8.8 which includes the dlls that works for Azure Function.
Our website: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet: https://www.nuget.org/packages/Spire.Doc/7.8.8

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Aug 20, 2019 8:38 am

we included the hotfix release 7.8.8. from nuget, but we still get the System.Drawing errors.

dinden
 
Posts: 16
Joined: Wed Aug 07, 2019 7:42 am

Tue Aug 20, 2019 10:39 am

Hi,

I am afraid you need to change the framework .NET Core to .NET Standard. The dlls which would work with Azure Function are placed in the folder .NETStardard2.0.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Aug 20, 2019 4:42 pm

We had it working using .NET core with the manual version posted in this thread.

dinden
 
Posts: 16
Joined: Wed Aug 07, 2019 7:42 am

Wed Aug 21, 2019 6:01 am

Hi,

On NuGet, the dlls will be installed according to its framework and folder. We placed the dlls which works for Azure Function in the folder .NETStardard2.0. If the framework of your project is .NET Core, it will install the dlls in the folder .NETCore2.0 while the dlls in it doesn't work with Azure Function. So I suggest you change the framework when installing via NuGet. Otherwise, you need to manually reference the dlls.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc