After installing PDFsharp-MigraDoc 6.1.1 from NuGet code
static ReportTemplateBase()
{
GlobalFontSettings.FontResolver = new NewFontResolver();
}
throws error
The type or namespace name 'NewFontResolver' could not be found (are you missing a using directive or an assembly reference?)
How to fix it?
Times New Roman and Arial .ttf files are copied to Debian to /usr/share/fonts/winfonts directory. How to use fonts in Debian from this directory for PDF creation?
Font files can be copied to other directories if this helps.
From documentation:
Note that NewFontResolver was renamed to SnippetsFontResolver with version 6.1.0 Preview 1. Note that SnippetsFontResolver is no longer available as of version 6.1.0 Preview 3.
Source:
https://docs.pdfsharp.net/General/History.html?q=newfontresolver
Functionality from NewFontResolver was moved to PlatformFontResolver, so Arial and Times New Roman should work under Linux without setting a font resolver if they worked with the NewFontResolver.
Better write your own IFontResolver so your code works everywhere, not just under Debian and some other distributions.
See also: https://docs.pdfsharp.net/PDFsharp/Topics/Fonts/About.html
A simple font resolver that reads .TTF files is the UnitTestFontResolver that can be found here:
https://github.com/empira/PDFsharp/blob/master/src/foundation/src/shared/src/PdfSharp.Testing/FontResolver/UnitTestFontResolver.cs
Simple to expand it to handle the 8+ .TTF files of Arial and Times New Roman.