Using a TWebBrowser component to view the PDF works for me
filename := TPath.Combine(TPath.GetDocumentsPath, 'Test.pdf');
WebBrowser1.Navigate('file:/' + filename);
Question
I am developing an iOS app using Delphi XE5.
I have manage to download and store a PDF on the local device (using the Indy HTTP control), but I am unable to open the file for viewing directly from the local device storage.
//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
I have tried using the Apple.Utils class in the samples folder and using SharedApplication.OpenURL but this does not work (even if I convert the filename to a NSUrl). Interestingly though, the canOpenURL returns true.
Does anyone have any suggestions for me to simply "open" the PDF in a standard app to view it. I have tried using the UIDocumentInteractionController but am not sure how to use it from the Delphi side.
Thanks, Brendan
Solution
Using a TWebBrowser component to view the PDF works for me
filename := TPath.Combine(TPath.GetDocumentsPath, 'Test.pdf');
WebBrowser1.Navigate('file:/' + filename);