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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to print PDF documents in Xamarin.Forms platform?

PDF documents can be printed in Xamarin Forms’ Android, iOS, and UWP platforms by obtaining the currently loaded PDF as stream and printing the stream using native printing functionalities available in the respective platforms using DependencyService of Xamarin Forms. These platform specific printing options can be used by defining an interface in the portable project and implementing the same in the platform projects using the specific code.

The following code snippets illustrate printing PDF documents in Xamarin Forms’ Android, iOS, and UWP platforms.


Define the following interface.



Load the PDF to PdfViewer. Call the Print method with the stream obtained from PdfViewer and file name using DependencyService when the print button is clicked in the code behind. Give the name of the interface as the type parameter to the method DependencyService.Get<T>().



Implement the interface in the platform projects with the available platform specific printing options.




Define a class derived from the PrintDocumentAdapter and write the contents of the input file to the print destination in the OnWrite method.









Sample link:



Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
8767 05/17/2018 07/03/2018 Xamarin.Forms PdfViewer 4.5.1
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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