Supported Platforms
GemBox.Presentation support for file formats depends on the used framework as following:
Support on Linux or macOS
When using GemBox.Presentation on a non-Windows platform, such as Linux or macOS, the HarfBuzzSharp package is used for text layout and the SkiaSharp package is used for rasterizing presentation content to a bitmap. For bitmap decoding and encoding, GemBox.Presentation uses SkiaSharp or SixLabors.ImageSharp packages.
These packages are required for saving to PDF or image formats, so your project must reference an appropriate HarfBuzzSharp.NativeAssets.* and SkiaSharp.NativeAssets.* NuGet packages depending on the platform on which your application is running.
Please note that the following features are currently not supported on non-Windows platform:
- Printing presentations.
- Saving presentations to XPS.
- Calling ConvertToImageSource and ConvertToXpsDocument methods.
These features currently have WPF dependencies which means they require a .NET Windows Desktop Runtime.
Support on Windows
When using GemBox.Presentation on a Windows operating system, the WPF is used for text layout, rasterizing presentation content to a bitmap, and bitmap decoding and encoding.
In order for the application to use WPF, it must target .NET Framework 4.6.2+, or target .NET 6.0+ with the Windows-specific TFM (e.g. "net6.0-windows") and a .NET Windows Desktop Runtime must be installed.
However, you can avoid using WPF, and instead use the same packages as for non-Windows platforms, by setting the RenderingMode property. This is useful in cases where an application is converting presentations to images with multiple threads because switching from RenderingMode.WPF to RenderingMode.Skia will then avoid creating a WPF Dispatcher instance for each thread.
Note
The SkiaSharp package is always used when saving the presentation to an SVG image, regardless of the specified ImageSaveOptions.RenderingMode
.
Important
The System.Drawing.Common package (GDI+) is used when exporting presentation images in SVG, WMF, and EMF format.
Support on Windows server
When saving to XPS or image format in an ASP.NET Core application using the WPF, you need a .NET Windows Desktop Runtime installed on the Windows server and you need to use a Windows-specific TFM in the project file (e.g. <TargetFramework>net6.0-windows</TargetFramework>
).
Also, you need to enable the following compatibility switch with the AppContext class:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
// Add compatibility switch.
AppContext.SetSwitch("Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable", true);
}
public IConfiguration Configuration { get; }
// ...
}
Alternatively, you can enable that compatibility switch by adding the following runtimeconfig.template.json file to your project:
{
"configProperties": {
"Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable": true
}
}