XE5 iOS应用程序 - 从本地存储打开PDF

时间:2013-11-04 12:31:05

标签: ios delphi-xe delphi-xe5

我正在使用 Delphi XE5 开发 iOS应用

我已设法在本地设备上下载并存储PDF(使用Indy HTTP控件),但我无法打开文件直接从本地设备存储中查看。

//This points to the correct file which exists (in the emulator)
filename := TPath.Combine(TPath.GetDocumentsPath, 'Test.pdf');
//points to  
//  /Users/myuser/Library/Application Support/iPhone Simulator/7.0.3/Applications/96674DE6-7997-48F9-9892-1383EBCE473B/Documents/Test.pdf

我已尝试在samples文件夹中使用Apple.Utils类并使用SharedApplication.OpenURL,但这不起作用(即使我将文件名转换为NSUrl)。有趣的是,canOpenURL返回true。

有没有人建议我在标准应用中“打开”PDF来查看它。我已经尝试过使用UIDocumentInteractionController,但我不确定如何在Delphi端使用它。

谢谢, 布伦丹

1 个答案:

答案 0 :(得分:1)

使用TWebBrowser组件查看PDF为我工作

filename := TPath.Combine(TPath.GetDocumentsPath, 'Test.pdf');
WebBrowser1.Navigate('file:/' + filename);