编辑iCloud PDF文件问题

时间:2018-12-14 04:19:29

标签: ios xamarin

我在iCloud中有PDF文件。我需要编辑它们。我尝试了许多方法,但PDF始终在acrobat Reader中作为副本打开。是否可以编辑它们而不复制到本地。请提供一些想法。

首先在这里我将pdf的文件上传到icloud。之后,我打开它。我试图将其打开到acrobat。,但没有直接将其打开。将出现一个对话框,要求复制到acrobat。

 public void UploadiCloud(string filepath, string fileName)
    {

        UIDocumentPickerViewController documentPicker = new UIDocumentPickerViewController(NSUrl.FromFilename(filepath), UIDocumentPickerMode.ExportToService);
        documentPicker.DidPickDocumentAtUrls += (object sender, UIDocumentPickedAtUrlsEventArgs e) =>
        {

            NSUrl adobeUrl = new NSUrl($"com.adobe.adobe-reader://");
            NSUrl fileUrl = NSUrl.FromFilename(filepath);
            UIDocumentInteractionController docController = UIDocumentInteractionController.FromUrl(fileUrl);

            if (UIApplication.SharedApplication.CanOpenUrl(adobeUrl))
            {

                Device.BeginInvokeOnMainThread(() =>
                {
                    UIView presentingView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;
                    docController.PresentOpenInMenu(CGRect.Empty, presentingView, true);

                });
            }
            else
            {

            }
        };
        documentPicker.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
        UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(documentPicker, true, null);

    }

0 个答案:

没有答案