Supported Platforms
The default rendering mode of GemBox.Document is RenderingMode.Internal, which uses a fully managed rendering engine for text layout, rasterizing document content to a bitmap, and bitmap decoding and encoding. It doesn't require any additional dependencies.
Please note that the following features are only supported on Windows:
- Printing documents.
- Calling ConvertToImageSource and ConvertToXpsDocument methods.
RenderingMode.Skia
If you want to use Skia for rendering, set the RenderingMode property to RenderingMode.Skia. In that case, the SkiaSharp package is used for rasterizing document content to a bitmap and the HarfBuzzSharp package is used for text layout.
RenderingMode.WPF
WPF rendering is only available on Windows platforms. To use it, set the RenderingMode property to RenderingMode.WPF, or use WPF-specific features such as ConvertToImageSource(ImageSaveOptions) or viewing documents in .
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.
Note that converting documents to images with multiple threads while using WPF rendering will result in creating a WPF Dispatcher instance for each thread.
Support on Windows server
When using the WPF rendering (for example, by setting the RenderingMode property to RenderingMode.WPF or by using an API that requires WPF) in an ASP.NET Core application, 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
}
}