Share PDF Documents


I know its possible to share images with third party apps such as DropBox using the FMX sharesheetaction component, however it doesn't seem possible to do the same with other objects (e.g. a PDF document).

We are already using the TMS iCL components to generate a PDF document (amongst other functionality).

Please can you advise how this would be possible and whether TMS has an offering for this capability?

Many thanks


TMS iCL has a non-visual control called TMSFMXNativeUIDocumentInteractionController which can be used to share PDF files and other file types using the iOS built-in share action


That's great thank you.  We have run into one issue however.
We have the following code (with the code that actually generates the document excluded for brevity):

      MsgResponse = True;
      if (FileExists(ThePDFFilenameFullPath) = True) then
        MsgResponse := TDialogServiceSync.MessageDialog('File Exists, Overwrite?', TMsgDlgType.mtConfirmation, mbOKCancel, TMsgDlgBtn.mbOK, 0);

      if (MsgResponse = mrOK) then
        // Code to create the report on disk is here
        TMSFMXNativeUIDocumentInteractionController1.&File := ThePDFFilenameFullPath;

When the filename doesn't exist, its created and the DocumentInterationController correctly displays the document.
When the filename does exist, it displays the delphi message dialog, but then when the dialog is closed the DocumentInterationController is not displayed.

We have forced it to create a different document when the existing one exists, and that has no bearing on the problem.

We can only assume that its a threading / timing issue between the delphi dialog and the native component, and that the native DocumentInterationController is perhaps being displayed but behind the delphi form ?

Have you experience this before?  Are you able to advise?

Many thanks.


It's unclear exactly what is happening, but haven't experienced issues like this before. It could be possible that you'll need to create an async dialog service which does not block the main thread.
If we look at the definition of ShowMessage, it uses TDialogServiceAsync for iOS and Android and TDialogServiceSync for Windows and OSX

procedure ShowMessage(const AMessage: string);