Search code examples
iosdelphipdffiremonkey

Open a PDF with Adobe Acrobat Reader in iOS with a Delphi Firemonkey app


I want my FireMonkey iOS app to open a PDF in Adobe Acrobat Reader that it has received by app tethering.

I've tried the Posix Shell Execute:

_system(MarshaledAString('open ' + 'myFile.pdf'));

But it doesn't work (note : I use :MarshaledAString, because PAnsiChar and AnsiString are not available for a mobile compiled application).

It is easily done with Android, but iOS....

Anyone know a way to make this happen?


Solution

  • It seems like iOS sandboxing makes it impossible for an app like Acrobat Reader to come and read a file belonging to the app I've built.

    The farthest I came was to open the PDF file in a TWebBrowser. But the file cannot be edited.

         frm := TForm.CreateNew(nil);
    
         btn := TButton.Create(frm);
         btn.Parent := frm;
         btn.Align := TAlignLayout.Top;
         btn.Text := 'Close';
    
         btn.OnClick := OnButtonClick;
         WebBrowswer := TWebBrowser.Create(frm);
    
         WebBrowswer.Parent := frm;
         WebBrowswer.Align := TAlignLayout.Client;
    
         WebBrowswer.Navigate('file://' + FLastFileReceivedFilePath);
         frm.Show;