How to open Adobe Acrobat Reader in xamarin ios

I need to open external app in xamarin forms ios. I have a pdf file and need to open it Adobe acrobat reader(already install in the device) Please help me. I am new to xamarin ios.

Tagged:

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Generally we use Url Scheme to open an external app. i.e.

    // Open a message app:
    Device.OpenUri(new Uri("sms:"));
    // Open a mail app
    Device.OpenUri(new Uri("mailto:"));
    // Open a phone call
    Device.OpenUri(new Uri("tel:"));
    

    You could contact to the support of Adobe reader to see if it has exposed this kind of api(maybe you can try com.adobe.adobe-reader:).

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭

    I tried com.adobe.adobe-reader but got error.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @AMNishanthiKumari Then you should contact with the adobe's supporter to see if adobe has this feature.

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭

    @Landlu Thanks for reply i will try

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭
    edited November 2018

    This is the code i tried. Dont know my code is correct or wrong.

    var url = new NSUrl($"com.adobe.adobe - reader:{"//private/var/mobile/Library/Mobile Documents/iCloud~com~company name~Mobile/Documents/001.pdf"}")

    UIApplication.SharedApplication.OpenUrl(url);

    I am getting this error

    Could not initialize an instance of the type 'Foundation.NSUrl': the native 'initWithString:' method returned nil.
    It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Remove the "{}". And I'm not sure this will be useful depending on whether adobe could receive this file path as parameter.

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭

    @LandLu Nothing changed. same error again

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭
    edited December 2018

    I found the code to open acrobat reader
    var url = new NSUrl($"com.adobe.adobe-reader://"); UIApplication.SharedApplication.OpenUrl(url);

    But I tried to give file path. its not worked.

    var url = new NSUrl($"com.adobe.adobe-reader:{filepath}");
    UIApplication.SharedApplication.OpenUrl(url);
    
Sign In or Register to comment.