Download PDF files when using the mobile client

  • David B.
        1 month ago #63327

        Hello,

        we are using the PDF-Plugin / PDF-Viewer to show/view PDF files in an application.

        This works fine for desktop and in the mobile client.

         

        We also added a little script so users can download the PDF on desktop.

        We tried to add this functionality for the mobile client as well and tried different things, but we can’t get it to work (for example, we tried FileSaver.js or cordova-plugin-file). Is there an elegant and easy solution for this rather “simple” request (saving a blob/file on mobile devices) we might be overlooking?

         

        Thanks in advance!

        Lukas Henninger
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the online course Advanced (320)
          1 month ago #63354
          Up
          0
          Down
          ::

          Hi David,

           

          have you checked, if the mobile action download file fits our usecase?

          In order to fully save a file to the mobile device, you could also try to (temporarily) upload your file into a ContentRepository and then use window.open(encodeURI(fileUrl),”_system”); with the urlWithToken. This will open the systems browser and download the file from there.

           

          I hope this helps you out.

          David B.
              1 month ago #63373
              Up
              0
              Down
              ::

              The Download File mobile action could work.

              We are not quite sure how the “url” should look like though?

              The info given here does not quite answer, how the url should be formatted.

              In the screenshot you can see our code which we used to create the URL. This URL looks like this, when the code is run on desktop:

              “blob:https://SIMPLIFIER-INSTANCE/4087264a-f6fc-4503-936a-b8dd37a6f7c0” – if i open this via browser, i can see my PDF file.

              When run on mobile, the code looks different and we get an error message that the URL ist not correct:

              “blob:file:///ID”

              If we replace the “blob:” with “”, we do not get the error anymore, but it says that there is no file.

               

              So as you can see, we are kind of lost how to create the correct URL.

              Thanks for your help!

              Attachments:
              You must be logged in to view attached files.
              Armin Winkler
                  Has successfully completed the online course Introduction
                  Has successfully completed the online course Intermediate (200)
                  Has successfully completed the online course Advanced (300)
                  Has successfully completed the online course Basics (100)
                1 week ago #64015
                Up
                0
                Down
                ::

                Hi David,

                 

                as of now there’s no other possibility to download a file to your mobile device using the Simplifier Mobile Client besides the two options mentioned earlier by Lukas:

                1. Utilize the Mobile Action ‘Download file’
                2. (Temporarily) Upload the file to the Content Repository and use the generated download URL to open it in cordova-plugin-inappbrowser with the value ‘_system’ passed for the ‘target’ argument

                The drawback of the former option is that you can only access files and display the contents within the scope of a Simplifier application as the files will be stored in a sandbox directory invisible in the device’s directory structure. The latter option on the contrary might be a bit more complex to implement and relies on scripting to some extent (e.g. when accessing the mentioned Cordova plugin). There’s already an internal feature request to improve the download capabilities for files on mobile devices, but feel free to submit your own feature request for that matter via our Ideas portal.

                 

                Kind regards,

                 

                Armin

                • This reply was modified 1 week ago by Armin Winkler.
                David B.
                    1 week ago #64037
                    Up
                    0
                    Down
                    ::

                    Hi Armin,

                    thank you very much for your reply!

                    After failing with option 1, we used the content repo and are now getting the results we wanted. By using the content repo, we can download and save the pdf on Desktop, Android & iOS.

                    You can mark this post as solved, thank you! 🙂

                  Viewing 5 posts - 1 through 5 (of 5 total)

                  You must be logged in to reply to this topic.