I am working on a Xamarin.Forms project.
I have to create an ID card from the details provided, in a certain format and print the same.
How can this be done?
Has anyone tried something like this?
I am working on a Xamarin.Forms project.
I have to create an ID card from the details provided, in a certain format and print the same.
How can this be done?
Has anyone tried something like this?
Disclaimer: I have NOT tried the following solution myself.
There is no out-of-the-box support in Xamarin.Forms for printing PDF.
The best practice, in terms of safety and native-performance, would be to use Dependency Injection by defining an interface in the portable (CPL or .NET Standard) project and implementing the actual printing code in the native projects you wish to target.
The following are the APIs for their respective platforms:
For Android: https://developer.xamarin.com/api/type/Android.Print.Pdf.PrintedPdfDocument/
For iOS: https://developer.xamarin.com/api/type/MonoTouch.UIKit.UIPrintInteractionController/
More of the same:
https://www.syncfusion.com/kb/8767/how-to-print-pdf-documents-in-xamarin-forms-platform
Hope it helps. Cheers!