35
Views
2
Comments
Solved
[File Viewer Plugin] How to set URI for opening a file from mobile application with File Viewer Plugin?
Question
file-viewer-plugin
Mobile icon
Forge asset by OutSystems
Application Type
Mobile

I'm a bit unsure about how to use the OpenDocument action provided by the File Viewer Plugin. I see that you get to choose in between sending in an URL or a file path. What value do I need to set for the URL, for instance, to view a pdf file stored in an Outsystems entity in the user's browser on their phone? 

UserImage.jpg
Gwendolyn Borchsenius
Solution

Thank you for your answer! What worked for me is using the SaveDocument action from the File plugin first and use the output URI as input for the OpenDocument action from the File Viewer Plugin.

UserImage.jpg
João Mota

Hi,
I had to do something like this not too long ago. What worked for me was to have a WEB screen to display that PDF (if it was a mobile screen it got bad formatting) and pass the link to that page in the PrintToPDF action and it will return a binary for that screen. 

For this to work that screen must use the web block PrintLayout\ScreenToPDF and you just build or display what you need over there.

On the initialize of that screen you must use the action ScreenToPDF_OnInitialize

On this action you can say if you want it to open in the browser or a preview (whichever suits yourself)

Lastly, but not least you also need to define the OnApplication ready of this screen with this:


To open the file using the browser send/set the OpenInBrowser attribute to true (Test it, it might be better the preview or the normal download and open).


Please note that my implementation required the same functionality for both web and mobile so I centralized all of it this way.


Also fot the URI it's the same I believe send that in the URL parameter. I used that as well but then switched. You can also use the File Viewer Plugin which, from my experience is faster but has less customization.

I hope this helps,

João Mota



UserImage.jpg
Gwendolyn Borchsenius
Solution

Thank you for your answer! What worked for me is using the SaveDocument action from the File plugin first and use the output URI as input for the OpenDocument action from the File Viewer Plugin.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.