.NET Standard lib PDFSharp

Hi, I'm trying to use the PDFSharp.netstandard2.0 and the many version that are similar to generate a pdf file into .NET standard 2.0 library that will be later used on both Xamarin.IOS and Xamarin.Android, but it faile when trying to load System.Drawing.FontFamily

According to this: apisof.net/catalog/System.Drawing.FontFamily (sorry remove the http protocol in front so I can post this)
I would need the .NET Standard + Platform Extensions (which I have no clue where I can find the platforms extensions that would provide this).

It always throw when entering into a function that create an XFont on the stack with the following error:
`Unhandled Exception:

System.TypeLoadException: Could not load type of field 'PdfSharp.Drawing.XFont:_gdiFontFamily' (14) due to: Could not resolve type with token 01000050 from typeref (expected class 'System.Drawing.FontFamily' in assembly 'System.Drawing.Common, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51') assembly:System.Drawing.Common, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type:System.Drawing.FontFamily member:(null) occurred`

I check the following nuget packages:

  • Microosft.Windows.Compatibility
  • System.Drawing.Common
  • System.Drawing.Primitives

But I'm a little lost why the package doesn't pull the required dependencies in the first place and where I can find that System.Drawing.FontFamily for .NET Standard that is required to make the package work.



  • marcioreckmarcioreck Member

    I´m in the same probleme here!

  • Sorry, I did not foudn any solution, I used Xfinium (trial version since I'm still into demo application.
    <PackageReference Include="Xfinium.Pdf.NetStandard" Version="8.3.3" />
    I never manage to make the PDFSharp.netstandard2.0 package actually work with .Net Standard 2.0, always fail at runtime.

Sign In or Register to comment.