Rendering PDF pages using pdfium in Xamarin Pdf Viewer (SfPdfViewer)
17 Mar 20231 minute to read
The Xamarin PDF Viewer allows using Pdfium, which is a third-party open-source PDF rendering engine, to render the pages of a PDF document. By default, the PdfViewer uses native PDF rendering. However, using the Pdfium rendering engine will overcome the defects in the native PDF rendering.
Setting the Renderer property
CustomPdfRenderer property to an instance of a class that implements the
ICustomPdfRenderer interface. Implementing this interface is explained in detail in the following sections.
CustomPdfRenderer property is not set, the pages are rendered using the default rendering of the SfPdfViewer control.
// Provides functionality to render PDF pages using third-party PDF renderers. pdfViewer.CustomPdfRenderer = DependencyService.Get<ICustomPdfRendererService>().AlternatePdfRenderer;
PDFium renderer sample
The sample that illustrates loading a PDF using the Pdfium renderer in Android and UWP can be downloaded from the link below.
At present, this feature is available on Android and UWP platforms only.
You can also explore our Xamarin.Forms PDF Viewer example to knows the functionalities of each feature.