Create a PDF control for Xamarin Forms
It could be useful to view a PDF file directly within your App. Xamarin Forms does not provide a specific control to view PDF files, but you can simply use a WebView to solve the problem.
Our PDFView control
Let's start by defining a class that extends the WebView object and define the URI property in order to pass the path of our PDF file:
The UIWebView control allows natively to open different types of files, including PDFs. It will therefore be enough to create a Renderer that directly loads the indicated file:
Android e UWP
Download the necessary files, and integrate them into the app, on Andorid in the Assets folder and on UWP in the root directory.
We then create our Renderer by loading the PDF.js library into the WebView with the specified file.
Now that our control is ready, we can call it from any page:
To view the complete project code click here.