Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Oct 06, 2020 8:14 am

Hello,

after I have updated the Spire.PDF package my code won't compile anymore.

The first problem was that some library apparently was moved from System.Drawing to System.Drawing.Common. By installing the System.Drawing.Common Package I was able to solve this issue by myself.

Issue 2:
Code: Select all
using Font font = new Font("Arial", 10, FontStyle.Regular);
textBoxField.Font = new PdfTrueTypeFont(font, true);


In this section I have 4 errors since the update:
1) "Arial": cannot convert from 'string' to 'System.Drawing.FontFamily'
2) FontStyle: The type 'FontStyle' exists in both 'Spire.Pdf, Version=6.9.16.0, Culture=neutral, PublicKeyToken=663f351905198cb3' and 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' => An update to Spire.Pdf.FontStyle does not help because the compiler says that this type does not exist.
3) (2nd line) font: cannot convert from 'System.Drawing.Font' to 'string'
4) true: Severity cannot convert from 'bool' to 'float'

Issue 3:
Code: Select all
PdfImage pdfImage = PdfImage.FromImage(schaleImage);

In this section I have one error:
'PdfImage' does not contain a definition for 'FromImage'

Thank you for your support.

Best regards,
David

dbutsch87
 
Posts: 2
Joined: Tue Oct 06, 2020 8:04 am

Tue Oct 06, 2020 10:42 am

Dear David,

Thank you for contacting us.
Did you update the latest Spire.PDF from Nuget in your .NET Core app? Kindly note that we made some adjustments for the dll's folder name on Nuget. We changed the folder ".NETCoreApp" to place the dlls which work for .NET Standard. For your situation, please download the latest Spire.PDF (Spire.PDF Pack(Hot Fix) Version:6.9.16) from our website, manually reference the .NET core dlls and then install the following two libraries in your .NET Core App. If there is any question, please feel free to write back.

.NETCoreApp 2.0
System.Drawing.Common (>= 4.5.0)
System.Text.Encoding.CodePages (>= 4.5.0)
.NETCoreApp 3.0
System.Drawing.Common (>= 4.7.0)
System.Text.Encoding.CodePages (>= 4.7.0)

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Tue Oct 06, 2020 12:26 pm

Thanks Nina,

that looks like it works (at least it compiles again).

May I ask why this hotfix is not yet published via nuget? Do you know when I can get back to the regular nuget version? I am not a fan of managing packages manually.

Best regards,
David

dbutsch87
 
Posts: 2
Joined: Tue Oct 06, 2020 8:04 am

Wed Oct 07, 2020 3:23 am

Hello,

Thanks for your response.
We are now having our Chinese National Day holiday from 01/10/2020 to 08/10/2020 (GMT+8:00). Once we get back to the office on 09/10/2020, we will adjust the nuget package ASAP. Sorry for the inconvenience caused by us and we appreciate your understanding.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Sat Oct 10, 2020 10:26 am

Hello,

Thanks for your patient waiting.
In fact, .NET Core itself has limitations in processing images and it is currently difficult to optimize, but the .NET Standard dll will have better performance in this regard, so starting from Spire.PDF v6.9.16, our Spire.PDF NuGet package will remove the .NET Core dlls. That is to say, for .NET Core apps, if you install our latest Spire.PDF via NuGet, the .NET Standard dll will be used by default.

Given the limitations of .NET Core, we prefer to recommend you use the .NET standard dll of our Spire.PDF. As for the compilation error you mentioned above, please use the following code instead.
Code: Select all
            textBoxField.Font = new PdfTrueTypeFont("Arial", 10, PdfFontStyle.Regular, true,true);

            PdfImage pdfImage = PdfImage.FromFile("filePath");
            //PdfImage pdfImage = PdfImage.FromStream(imageStream);


Of course, if you still want to use the dll of .NET Core, we have uploaded a new NuGet package for .NET Core, below is the corresponding link.
https://www.nuget.org/packages/Spire.PDF.NETCore/

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Feb 02, 2022 11:31 am

When using the NuGet packages, type conflicts with System.Drawing can be resolved this way by adding a namespace prefix(alias) for spire assemblies:
csproj:
Code: Select all
<PackageReference Include="Spire.Officefor.NETStandard" Aliases="SpireNetStandard" />

c#:
Code: Select all
extern alias SpireNetStandard;
using ...
using ...

...

var book = new SpireNetStandard.Spire.Xls.Workbook(); //all Spire namespaces are now prefixed in current project. Spire's System.Drawing classes are now in the SpireNetStandard.System.Drawing namespace and conflicts are resolved.

startrunner
 
Posts: 2
Joined: Thu Jan 20, 2022 8:32 am

Thu Feb 03, 2022 6:34 am

Okay, thanks for your sharing.
If there are any other issues related to our products, just feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF