fontspdf-generationpdfsharpmigradoc

How to resolve all available fonts and get list of fonts which can be rresolved when creating PDF?


PDFsharp-MigraDoc 6.1.0 Core build uses fallback font resolver

  static ReportTemplateBase()
  {
    GlobalFontSettings.FallbackFontResolver = new FailsafeFontResolver();
  }

Running it from Visual Studio in Windows shows that some fonts like Webdings and Wingdings are not resolved:

enter image description here

If same font names are used in HTML page in Chrome, result is correct:

enter image description here

How to force PDFsharp Core to resolve all fonts available in OS where it runs? How to get list of font names which are resolved?


Solution

  • It is up to you to write a font resolver that handles all the fonts you need on all platforms you want to support.
    How should PDFsharp Core find Wingdings when your code runs under Xamarin or Raspberry Pi?

    See also:
    https://docs.pdfsharp.net/PDFsharp/Topics/Fonts/About.html

    Pro tip: Do not use the portable Core build of PDFsharp if you only target Windows. Both the GDI and WPF builds will automatically load all the fonts from the Windows Fonts folder.