PDF rendering with external graphic engines

XFINIUM.PDF 6.4 brings support for using external graphic engines, such as GDI+ or Skia, when rendering PDF files.

The XFINIUM.PDF rendering library includes its own graphic engine for rendering PDF files. This means that we implemented path stroking and filling, gradients, image drawing, etc from scratch. The advantage is that the rendering engine is fully portable and the results are identical on all platforms. The drawback is that in some situations the rendering engine can be slow. Because of this we added support for external graphic engines which take the task of drawing and filling paths, drawing images etc thus improving the rendering speed.

As we had to implement interfaces for each graphic engine on each platform, not all graphic engines are available for all platforms. WinForms / ASP.NET support GDI+ and Skia, WPF supports GDI+ and Skia, UWP supports Win2D, Xamarin.Android supports Skia and Xamarin.iOS supports CoreGraphics.

These graphic engines are available as addon to XFINIUM.PDF Professional Editions and can be downloaded here. They are not included in the main install kits because they are optional and we did not want to increase the size of the main install kits. The evaluation version downloads include everything you need to get started and see how to render a PDF page using the external engine but we recommend to download also the full install kits in order to get the complete samples and help files.

WinForms / ASP.NET

GDI+ graphic engine

The graphic renderer based on GDI+ engine is implemented in Xfinium.Graphics.Win.Gdi.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Win.Gdi.dll (besides Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

VB.NET:

Only the PdfArgbIntRenderingSurface and PdfBgraByteRenderingSurface surfaces are supported by the GDI+ graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the GDI+ graphic renderer in your application, you need to deploy the Xfinium.Graphics.Win.Gdi.dll along with Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll.
The Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll assemblies included in Redist folder are the same ones included in the main install kit.

Skia graphic engine

The graphic renderer based on SkiaSharp engine is implemented in Xfinium.Graphics.Win.Skia.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Win.Skia.dll (besides Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

VB.NET:

In your application’s project file add these sections:

Update the value of ‘Include’ attributes with the actual paths to the libSkiaSharp.dll. Your application needs to be compiled for x86 or x64 (AnyCPU will not work) in order for the correct libSkiaSharp.dll to be copied in the output folder.

Only the PdfArgbIntRenderingSurface and PdfBgraByteRenderingSurface surfaces are supported by the Skia graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the Skia graphic renderer in your application, you need to deploy the Xfinium.Graphics.Win.Skia.dll, SkiaSharp.dll, libSkia.dll (x86\libSkiaSharp.dll for 32bit apps, x64\libSkiaSharp.dll for 64bit apps) along with Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll.
Make sure the Microsoft Visual C++ 2015 Redistributable is installed if this error occurs: Unable to load DLL ‘libSkiaSharp.dll’: The specified module could not be found.
The Skia graphic renderer requires .NET 4.5 or higher.

The Xfinium.Pdf.Win.dll and Xfinium.Pdf.Render.Win.dll assemblies included in Redist folder are the same ones included in the main install kit.

WPF

GDI+ graphic engine

The graphic renderer based on GDI+ engine is implemented in Xfinium.Graphics.Wpf.Gdi.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Wpf.Gdi.dll (besides Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

VB.NET:

Only the PdfArgbIntRenderingSurface and PdfBgraByteRenderingSurface surfaces are supported by the GDI+ graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the GDI+ graphic renderer in your application, you need to deploy the Xfinium.Graphics.Wpf.Gdi.dll along with Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll.

The Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll assemblies included in Redist folder are the same ones included in the main install kit.

Skia graphic engine

The graphic renderer based on SkiaSharp engine is implemented in Xfinium.Graphics.Wpf.Skia.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Wpf.Skia.dll (besides Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

VB.NET:

In your application’s project file add these sections:

Update the value of ‘Include’ attributes with the actual paths to the libSkiaSharp.dll. Your application needs to be compiled for x86 or x64 (AnyCPU will not work) in order for the correct libSkiaSharp.dll to be copied in the output folder.

Only the PdfArgbIntRenderingSurface and PdfBgraByteRenderingSurface surfaces are supported by the Skia graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the Skia graphic renderer in your application, you need to deploy the Xfinium.Graphics.Wpf.Skia.dll, SkiaSharp.dll, libSkia.dll (x86\libSkiaSharp.dll for 32bit apps, x64\libSkiaSharp.dll for 64bit apps) along with Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll.

Make sure the Microsoft Visual C++ 2015 Redistributable is installed if this error occurs: Unable to load DLL ‘libSkiaSharp.dll’: The specified module could not be found.
The Skia graphic renderer requires .NET 4.5 or higher.

The Xfinium.Pdf.Wpf.dll and Xfinium.Pdf.Render.Wpf.dll assemblies included in Redist folder are the same ones included in the main install kit.

UWP

Win2D graphic engine

The graphic renderer based on Win2D engine is implemented in Xfinium.Graphics.Uwp.Win2D.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Uwp.Win2D.dll (besides Xfinium.Pdf.Uwp.dll and Xfinium.Pdf.Render.Uwp.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

VB.NET:

In your application’s project file add these sections:

Update the value of ‘Include’ attributes with the actual paths to the Microsoft.Graphics.Canvas.winmd and Microsoft.Graphics.Canvas.dll. Your application needs to be compiled for x86, x64 or ARM (AnyCPU will not work) in order for the correct Microsoft.Graphics.Canvas.dll to be copied in the output folder.

Only the PdfArgbIntRenderingSurface and PdfBgraByteRenderingSurface surfaces are supported by the Skia graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the Win2D graphic renderer in your application, you need to deploy the Xfinium.Graphics.Uwp.Win2D.dll, Microsoft.Graphics.Canvas.winmd, Microsoft.Graphics.Canvas.dll

(win10-arm\Microsoft.Graphics.Canvas.dll for ARM apps, win10-x86\Microsoft.Graphics.Canvas.dll for 32bit apps, win10-x64\Microsoft.Graphics.Canvas.dll for 64bit apps) along with Xfinium.Pdf.Uwp.dll and Xfinium.Pdf.Render.Uwp.dll.

The Xfinium.Pdf.Uwp.dll and Xfinium.Pdf.Render.Uwp.dll assemblies included in Redist folder are the same ones included in the main install kit.

Xamarin.Android

Skia graphic engine

The graphic renderer based on SkiaSharp engine is implemented in Xfinium.Graphics.Xamarin.Android.Skia.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Xamarin.Android.Skia.dll (besides Xfinium.Pdf.Xamarin.Android.dll and Xfinium.Pdf.Render.Xamarin.Android.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

Only the PdfRgbaIntRenderingSurface and PdfRgbaByteRenderingSurface surfaces are supported by the Skia graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the Skia graphic renderer in your application, you need to deploy the Xfinium.Graphics.Xamarin.Android.Skia.dll, SkiaSharp.dll along with Xfinium.Pdf.Xamarin.Android.dll and Xfinium.Pdf.Render.Xamarin.Android.dll.

The Xfinium.Pdf.Xamarin.Android.dll and Xfinium.Pdf.Render.Xamarin.Android.dll assemblies included in Redist folder are the same ones included in the main install kit.

Xamarin.iOS

CoreGraphics graphic engine

The graphic renderer based on CoreGraphics engine is implemented in Xfinium.Graphics.Xamarin.iOS.CoreGraphics.dll assembly (located in the Redist folder).
Add a reference in your project to Xfinium.Graphics.Xamarin.iOS.CoreGraphics.dll (besides Xfinium.Pdf.Xamarin.iOS.dll and Xfinium.Pdf.Render.Xamarin.iOS.dll) and in your code add this line after creating the PdfPageRenderer object:
C#:

Only the PdfRgbaByteRenderingSurface surface is supported by the CoreGraphics graphic engine.

Please see PDFToImage sample (included in graphic engine install archive, not the main install kit) for more details.

If you choose to use the CoreGraphics graphic renderer in your application, you need to deploy the Xfinium.Graphics.Xamarin.iOS.CoreGraphics.dll along with Xfinium.Pdf.Xamarin.iOS.dll and Xfinium.Pdf.Render.Xamarin.iOS.dll.

The Xfinium.Pdf.Xamarin.iOS.dll and Xfinium.Pdf.Render.Xamarin.iOS.dll assemblies included in Redist folder are the same ones included in the main install kit.

Leave a Reply