How to open local pdf file in xamarin.ios app to read?

sumitmishrasumitmishra Member ✭✭✭
edited January 16 in Xamarin.iOS

Hi,
I am trying to open .pdf file to read from iPhone File app using UIDocumentInteractionController. File is saved in myfolder inside File app. But UIDocumentInteractionController is just sowing name in title but not open all document.

Can you please help me to open local file in Xamarin.ios native app.

Here is my code..

 var previewController = UIDocumentInteractionController.FromUrl(
 NSUrl.FromFilename(“File/MyFolder/pdf-test.pdf"));

 previewController.Delegate = new MyInteractionDelegate(this);
 previewController.PresentPreview(true);


  public class MyInteractionDelegate : UIDocumentInteractionControllerDelegate
        {
            UIViewController parent;
            public MyInteractionDelegate(UIViewController controller)
            {
                parent = controller;
            }
            public override UIViewController ViewControllerForPreview(UIDocumentInteractionController controller)
            {
                return parent;
            }
        }

Answers

Sign In or Register to comment.