Use UIDocumentInteractionController in Delphi XE

别说谁变了你拦得住时间么 提交于 2019-12-11 09:03:00

问题


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.

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.

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.

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


回答1:


I have solved this problem by installing D.P.F. Delphi iOS Native Components

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

DPFQLPreviewController1.ShowDoc(filename, false);

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.



来源:https://stackoverflow.com/questions/20488564/share-local-file-with-other-apps

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