Design and print PDF in Xamarin.Forms

女生的网名这么多〃 提交于 2019-12-13 09:28:36

问题


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?


回答1:


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:

  1. For Android: https://developer.xamarin.com/api/type/Android.Print.Pdf.PrintedPdfDocument/

  2. 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!



来源:https://stackoverflow.com/questions/51242420/design-and-print-pdf-in-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!