fastreport export to pdf , Run on windows is ok,run on archlinux threw exception
---> System.TypeInitializationException: The type initializer for 'FastReport.Utils.Config' threw an exception.
---> System.TypeInitializationException: The type initializer for 'FastReport.TypeConverters.FontConverter' threw an exception.
---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
at System.Drawing.Text.FontCollection..ctor()
at System.Drawing.Text.PrivateFontCollection..ctor()
at FastReport.TypeConverters.FontConverter..cctor()
--- End of inner exception stack trace ---
at FastReport.TypeConverters.FontConverter.get_PrivateFontCollection()
at FastReport.Utils.FRPrivateFontCollection..ctor()
at FastReport.Utils.Config..cctor()
--- End of inner exception stack trace ---
at FastReport.Utils.Config.Init()
at FastReport.Report..cctor()
--- End of inner exception stack trace ---
at FastReport.Report..ctor()
Comments
Hello!
The issue with exporting to PDF on Arch Linux – whilst it works fine on Windows – is caused by the project using classic GDI+-based packages, which are no longer supported on Linux from .NET 6/7 onwards and throw an exception (furthermore, without the Skia package or fonts, there is no graphical backend on Linux).
What you need to do for Linux (Arch Linux / Docker / Ubuntu):
Switch from the FastReport.Core / FastReport.Net package in your project to the FastReport.Core.Skia package (FastReport.Core.Skia.Demo), which uses SkiaSharp instead of System.Drawing.Common.
On Arch Linux, ensure that the native SkiaSharp dependencies are installed (the NuGet package SkiaSharp.NativeAssets.Linux.NoDependencies, plus the system fontconfig and basic TrueType fonts, such as ttf-liberation and ttf-dejavu).