To create high-quality reports and correctly export them to different formats (PDF, Word, Excel, etc.), it is necessary to use the graphics engine. Since the earliest versions of the .NET Framework, Microsoft has used GDI+ and its wrapper as part of the System.Drawing library. FastReport .NET has long been using the same library to create beautiful and functional reports. The Mono team has developed their GDI+ version for Unix systems: libgdiplus, which is used by System.Drawing.Common. However, this method does not work perfectly.
Unfortunately, unlike on Windows, System.Drawing.Common works on other platforms very specifically. Such common issues that we receive from our users include incorrect rendering text sizes, lack of RTL language support, incorrect word spacing, word break error in sentences, lack of ARM processor support, and general libgdiplus instability (“Out of memory”, problems during the work in a multi-threaded configuration).
You can solve some of these problems by manually rebuilding libgdiplus from the Mono repository with Pango/Cairo support. In any case, this is inconvenient, especially if your application uses containerization. The other problems affect the quality of report export on all operating systems except Windows.
As a result, Microsoft officially dropped support for System.Drawing.Common on non-Windows platforms. Here is their post:“Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Docs“. After it, our users began to actively ask how they could use the powerful functionality of FastReport on Linux or macOS.
We have developed a special version of FastReport.Core, which uses Skia as a graphics engine and its wrapper for .NET - SkiaSharp, called FastReport.Core.Skia. The FastReport.Core.Skia and FastReport.Web.Skia packages are available on our private NuGet server.
In case you have problems rendering text under Linux with libgdiplus, we highly recommend trying FastReport.Core.Skia. To use it in your application, just change the package name FastReport.Core -> FastReport.Core.Skia, and add the following packages on Linux (on Windows and macOS, the necessary packages are added automatically):
- SkiaSharp.NativeAssets.Linux (NuGet).
- HarfBuzzSharp.NativeAssets.Linux (NuGet).
Let's now compare FastReport.Core with libgdiplus and FastReport.Core.Skia on Linux/macOS.
First, let's look at the incorrect calculation of text length after exporting to HTML format on Linux Ubuntu 20.04. In the images below, you can see how libgdiplus with Pango, even rebuilt from the source, does not display the end of the 1st line correctly, dropping some information, Skia works fine.
Incorrect HTML export on Linux, libgdiplus + Pango
Correct HTML export on Linux, SkiaSharp
Let's look at exporting the Unicode.frx report from our demo with texts in different languages. Unfortunately, even after rebuilding libgdiplus with Pango, it does not work with RtL languages such as Hebrew, Arabic, and others. FastReport.Core.Skia can work with such languages.
Incorrect PDF export of RtL text on Linux, libgdiplus with Pango wrote all text in 1 column for 8 pages
Correct PDF export of RtL text on Linux, SkiaSharp
We can see the similar situation with some Eastern languages, the correct display of which requires a special font:
Incorrect PDF export of text on Linux, libgdiplus with Pango
Correct PDF export of text on Linux, Skia. An appropriate font is automatically selected for each text.
Let's try FastReport.Core.Skia in a previously unsupported scenario: working on devices with ARM processors, such as Apple M1. Let's create a .NET 6 console application (because only .NET 6 has native support for ARM architecture for macOS) and export the Simple List.frx report from our demo.
In the end, we recall that System.Drawing.Common, starting with version 7.0, will completely stop supporting non-Windows systems, so the examples of libgdiplus given above will soon not work at all.
This version of FastReport.Core cannot be used with the System.Drawing API: in some .NET Framework projects, NET Core 3.1/ NET 5+ WindowsForms projects, and in projects with System.Drawing.Common due to the specifics of this modification.
Try the new version of FastReport.Core with SkiaSharp support and enjoy all its advantages. If you have any questions, please contact our Support.