We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use Pdfium rendering engine with PdfViewer in Xamarin Forms Android

Platform: Xamarin.Forms |
Control: PdfViewer

By default, PdfViewer uses native Android PDF rendering. But, it also provides options in both Xamarin.Forms Android and Xamarin.Android platforms to use Pdfium that is a third party open source PDF rendering engine. Pdfium is the solution for overcoming defects in native Android rendering.     


Creating Pdfium binding library


To use Pdfium in your application, the Pdfium binding library is needed. A Pdfium binding library has already been created for your convenience and  is available with the demo sample attached at the bottom of this article.

The Pdfium binding project can also be created from scratch by following the steps below.


  1. Download the pdfium-android-1.7.0.aar android archive file from  https://mvnrepository.com/artifact/com.github.barteksc/pdfium-android/1.7.0


  1. To create the binding project from this archive file, refer to https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-an-aar/


  1. Install the Xamarin.Android.Support.Compat dependency package in the project.


  1. Compile the project to generate the Pdfium library.


Using the Pdfium binding library in the application project


Refer to the binding library in your android project.   

Add a new class named “CustomPdfRenderer” to the android application project. This class must implement the ICustomPdfRenderer and ICustomPdfRendererService interfaces defined in the Syncfusion.SfPdfViewer.XForms.Droid and Syncfusion.SfPdfViewer.XForms namespaces respectively.


The entire CustomPdfRenderer class is given as follows.



The CustomPdfRenderer property should be assigned to the AlternatePdfRenderer property of the CustomPdfRenderer class.



Sample link:


2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile