Delphi XE8 Firemonkey Create Open In App View PDF IOS

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

2 Responses to Delphi XE8 Firemonkey Create Open In App View PDF IOS

  1. Alvaro Maia says:

    HOW CAN I SHARE A LOCAL PDF FILE ON USING iOS?

    • Admin says:

      http://www.tmssoftware.com/site/tmsicl.asp

      uses

      FMX.TMSNativeUIActivityViewController
      {$IFDEF IOS}
      , iOSapi.Foundation, FMX.Platform.Ios, iOSapi.UIKit, Macapi.Helpers
      {$ENDIF}
      TMyForm = class(TForm)
      AVC: TTMSFMXNativeUIActivityViewController;
      private
      {$IFDEF IOS}
      FController : UIDocumentInteractionController;
      {$ENDIF}
      procedure OpenIn(path: string);

      procedure TMyForm.Button1Click(Sender: TObject);
      begin
      OpenIn(TPath.GetDocumentsPath + PathDelim + ‘manual.pdf’);
      end;

      {$IFDEF IOS}
      function MakeNSRect(ox, oy, sx, sy: Single): NSRect;
      begin
      Result.origin.x := ox;
      Result.origin.y := oy;
      Result.size.width := sx;
      Result.size.height := sy;
      end;
      {$ENDIF}

      procedure TDocsListForm.FormCreate(Sender: TObject);
      begin
      {$IFDEF IOS}
      FController := TUIDocumentInteractionController.Wrap(
      TUIDocumentInteractionController.Alloc.init);
      {$ENDIF}
      end;

      procedure TDocsListForm.OpenIn(path: string);
      {$IFDEF IOS}
      var
      URL: NSURL;
      success : Boolean;
      {$ENDIF}
      begin
      {$IFDEF IOS}
      URL := TNSUrl.Wrap(TNSUrl.OCClass.fileURLWithPath(StrToNSStr(path)));
      FController.setURL(URL);
      FController.setUTI(StrToNSStr(‘com.adobe.pdf’));
      success := FController.presentOpenInMenuFromRect(MakeNSRect(0, 0, 0, 0),AVC.GetParentView,True)
      {$ENDIF}
      end;

Leave a Reply

Show Buttons
Hide Buttons