How to use Pdfium rendering engine in WPF PdfViewer?
From 16.1.0.24 to 16.2.0.50 version of Essential Studio® release, the WPF PDF Viewer control provides a robust rendering of PDF document using the Pdfium rendering engine. Refer to the following steps to use Pdfium rendering in Syncfusion PDF viewer.
- Copy the Pdfium assembly’s folder to a local folder from the installation path. The folder name must be “Pdfium”.
The Pdfium assemblies will be available in
{$SystemDrive}:\Program Files (x86)\Syncfusion\Essential Studio®\{Essential Studio® version}\Pdfium
The Pdfium folder will contain two folders namely X86 and X64, both contains pdfium.dll assembly for the respective architecture. The Syncfusion PDF viewer is designed to detect the architecture of the target machine in which it is deployed, and pick the corresponding pdfium.dll to use it.
- Then, the ReferencePath property of PDF viewer should be set to locate the “Pdfium” folder.
Refer to the following code snippet.
string pdfiumPath = @"D:\";
//Set the reference path of Pdfium assemblies
pdfViewerControl1.ReferencePath = pdfiumPath;
//Set the rendering engine of PDF viewer to Pdfium
pdfViewerControl1.RenderingEngine = Syncfusion.Windows.Forms.PdfViewer.PdfRenderingEngine.Pdfium;
if (Directory.Exists(pdfiumPath + "Pdfium"))
{
//Load the PDF document in PDF viewer
pdfViewerControl1.Load(@"../../Data/PDF_Succinctly.pdf");
}
else
{
//Display the error message, if the Pdfium reference path is invalid.
MessageBox.Show("Please provide a valid Pdfium reference path", "Invalid reference path");
this.Close();
}
Find the demo from https://www.syncfusion.com/downloads/support/directtrac/general/ze/WF-774387065
From 16.3 (2018 volume 3) version of Essential Studio® release, “Pdfium” library is embedded with the PDF viewer control. So, it is not necessary to set the reference path to PDF viewer and the default rendering engine of the PDF viewer is made by Pdfium.
Conclusion
I hope you enjoyed learning how to use Pdfium rendering engine in Syncfusion PDF viewer for WPF.
You can refer to our WPF PdfViewer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF PdfViewer example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!