在Delphi XE中使用UIDocumentInteractionController [英] Use UIDocumentInteractionController in Delphi XE

查看:169
本文介绍了在Delphi XE中使用UIDocumentInteractionController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Delphi XE5应用程序,它可以在设备上本地下载和存储PDF。我在表单上有一个TWebBrowser来查看PDF并且它运行良好。

I have a Delphi XE5 app which downloads and stores PDFs locally on the device. I have a TWebBrowser on the form to view the PDFs and it works perfectly.

我现在希望与其他应用程序(例如Safari,Mail等)共享PDF我真的很挣扎!我查看了TShowShareAction操作(在动作列表控件上),但是这需要共享一个Bitmap(照片)。

I now wish to share the PDF with other applications (eg Safari, Mail, etc) but am really struggling! I have looked at the TShowShareAction action (on the Action List control) but this caters for a Bitmap (photo) to be shared.

我看过很多帖子解释那个人应该使用UIDocumentInteractionController,但我找不到如何在Delphi中使用它的例子。我看过Apple.Utils但无济于事。

I have seen a lot of posts explaining that one should use UIDocumentInteractionController but I cannot find examples of how to use this from within Delphi. I have looked at Apple.Utils but to no avail.

有没有人在Delphi应用程序中使用UIDocumentInteractionController功能来共享文件?任何一个例子都会非常感激!

Has anyone used the UIDocumentInteractionController functionality from within a Delphi application to share a file? Any example would be much appreciated!

推荐答案

我已经通过安装 DPF Delphi iOS原生组件

然后我在表单中添加了一个DPFQLPreviewController,并使用以下代码打开PDF:

I then added a DPFQLPreviewController to my form and open the PDF with the following code:

DPFQLPreviewController1.ShowDoc(filename, false);

这将打开标准iOS预览器中的PDF,这里有一个按钮,可以与之共享文件其他已安装的可以读取文件的应用程序(例如PDF应用程序,电子邮件,发送到打印机等)

This opens the PDF in the standard iOS previewer and this has a button enabling one to share the file with other installed apps that can read the file (eg a PDF app, email, send to printer, etc)

这是迄今为止我找到并且完美运行的最简单的解决方案在模拟器和实际设备上。

This is by far the simplest solution I have found and works perfectly on the simulator and an actual device.

这篇关于在Delphi XE中使用UIDocumentInteractionController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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