3 Replies Latest reply on Jan 24, 2018 9:15 PM by javierb22317554

    Form filling PDF files using Adobe Reader via FileProvider on Android Nougat

    cjlotz

      Hi

       

      We've been using Adobe Reader to allow our users to fill electronic PDF forms from our app by launching an VIEW Intent with a File URI.  This has been working fine until Android Nougat/7.  Strangely enough Adobe Reader doesn't seems to support EDIT intents, but still allows us to use a VIEW intent for form filling.   With Android 7/Nougat you are now required to use a Content Uri and a FileProvider to grant external apps access to your files in your app security sandbox.  We've made the changes to our code to use the FileProvider for API 24 and later.  Adobe Reader launches successfully and you can do form filling, but it seems to make a copy of the PDF instead of working on the file that directly that we grant Read/Write access to via the Content URI.

       

      What are the supported intent actions for Adobe Reader on Android?  Does it only support VIEW intents?  What about EDIT intents?  How can we get Adobe Reader to use the content URI we provide instead of making a copy of the file?   Any code sample of how this can work with Adobe Reader would be great.  We have tested our code with other PDF readers like Xodo PDF reader and they all work great.  However, we would prefer for our users to stick with Adobe Reader.

       

      Thanks

        • 1. Re: Form filling PDF files using Adobe Reader via FileProvider on Android Nougat
          cjlotz Level 1

          Any feedback from Adobe would be appreciated

          • 2. Re: Form filling PDF files using Adobe Reader via FileProvider on Android Nougat
            stefs36457347

            Hallo cjlotz!

             

            I am facing the exact same problem, but with my implementation it isn't working with xodo either!

             

            Any chance you can share your implementation so that I'm getting at least xodo to work?

             

            Kind regards!

            stef

            • 3. Re: Form filling PDF files using Adobe Reader via FileProvider on Android Nougat
              javierb22317554 Level 1

              I have the same problem, other applications like Xodo work well just sending the document with ACTION_VIEW, it actually asks what to do when the file is being opened, if it should create a copy or work with the same file.

               

              intent = new Intent();

              intent.setAction(Intent.ACTION_VIEW);

              intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);

              intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

              intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

              intent.setDataAndType(fileUri,"application/pdf");

               

              as a sidenote for anyone having troubles for this, remember to generate the uri with the right permissions as well, in my case since i picking a file from the system i use

               

              public void scanFile(){

                Intent intent = new Intent();

                 //intent.setAction(Intent.ACTION_GET_CONTENT);
                 intent.setAction(Intent.ACTION_OPEN_DOCUMENT);

                intent.addCategory(Intent.CATEGORY_OPENABLE);

                intent.setType("application/pdf");

                startActivityForResult(intent, 1212); // 1212 is just a flag for my app

              }

               

              And for the developers i have the same problem on iOS, you really need to implement the URL schemes on iOS and share its format on your page so developers can open a pdf directly with adobe.

              1 person found this helpful