在Xamarin.Forms中设计和打印PDF [英] Design and print PDF in Xamarin.Forms

查看:320
本文介绍了在Xamarin.Forms中设计和打印PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Xamarin.Forms项目.

I am working on a Xamarin.Forms project.

我必须从提供的详细信息中以某种格式创建一个ID卡,然后打印该ID卡.

I have to create an ID card from the details provided, in a certain format and print the same.

这怎么办?

有人尝试过这样的事情吗?

Has anyone tried something like this?

推荐答案

免责声明:我自己尚未尝试以下解决方案.

Disclaimer: I have NOT tried the following solution myself.

Xamarin中没有现成的支持.用于打印PDF的表单.

There is no out-of-the-box support in Xamarin.Forms for printing PDF.

就安全性和本机性能而言,最佳实践是使用依赖注入,方法是在便携式(CPL或.NET Standard)项目中定义一个接口,并在您希望的本机项目中实现实际的打印代码.目标.

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.

以下是其各自平台的API:

The following are the APIs for their respective platforms:

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

对于iOS: https://developer.xamarin. com/api/type/MonoTouch.UIKit.UIPrintInteractionController/

更多相同之处:

https://www.syncfusion.com/kb/8767/how-to-print-pdf-documents-in-xamarin-forms-platform

希望它会有所帮助.干杯!

Hope it helps. Cheers!

这篇关于在Xamarin.Forms中设计和打印PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆