Hi

I am working on mobile app and want to open a word document(which I have saved in resource folder) on click of a link.

BUT it is not working.

Hello Shubham,


Why are you filling both filePath and urlFile parameters?


The filePath parameter is to use when you want to open a file which is saved in the device file system. The urlFile is the parameter to use when you want to open a file from a URL.

In this case, you want to open a file from your device, so you just need to fill the filePath parameter only.


Kind regards,

Rui Barradas

Hello again Shubham,


Also, your mimeType parameter is incorrect. Try to use application/pdf for PDF files and application/octet-stream for other types of files.


Kind regards,

Rui Barradas

Rui Barradas wrote:

Hello Shubham,


Why are you filling both filePath and urlFile parameters?


The filePath parameter is to use when you want to open a file which is saved in the device file system. The urlFile is the parameter to use when you want to open a file from a URL.

In this case, you want to open a file from your device, so you just need to fill the filePath parameter only.


Kind regards,

Rui Barradas

Hi

Still not working.


Rui Barradas wrote:

Hello again Shubham,


Also, your mimeType parameter is incorrect. Try to use application/pdf for PDF files and application/octet-stream for other types of files.


Kind regards,

Rui Barradas

Hi Rui

I have made the changes. It is still not working. 


Anyway can you share an OML?It would be helpful.

Thanks.


Hi Shubham,

I created a small demo app covering your requirement, hope this will help you in some way.

PFA - includes .oml solution file

check this:  Demo App


Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Shubham,

I created a small demo app covering your requirement, hope this will help you in some way.

PFA - includes .oml solution file

check this:  Demo App


Hope this helps you!


Regards,

Benjith Sam

Hi Benjith 

The above given solution works if I am putting a url of file on another server. We want to show a doc which is  in the resource folder.And I am not sure whether I am giving the correct url or not. 

Can you please give the proper sequence of url ?


Thanks and Regards

Shubham Agarwal


You can use like below.Pls see attached too



Shubham Agarwal wrote:

Benjith Sam wrote:

Hi Shubham,

I created a small demo app covering your requirement, hope this will help you in some way.

PFA - includes .oml solution file

check this:  Demo App


Hope this helps you!


Regards,

Benjith Sam

Hi Benjith 

The above given solution works if I am putting a url of file on another server. We want to show a doc which is  in the resource folder.And I am not sure whether I am giving the correct url or not. 

Can you please give the proper sequence of url ?


Thanks and Regards

Shubham Agarwal



Hi Shubham,

In the attached .oml solution, if you observe the defined IFrame is referring  the document file from Resource Directory of the same environment not from the external env resource.

Syntax

https://docs.google.com/viewer?embedded=true&url=ResourceURL


Resource Url: Environment_Path + Resource_File_Runtiem_Path


SyntaxEditor Code Snippet

https://docs.google.com/viewer?embedded=true&url=https://sbsam.outsystemscloud.com/TestMe/Sample.docx


For more reference: https://stackoverflow.com/questions/9193144/how-to-open-specific-page-on-googles-docs-viewer


Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Shubham Agarwal wrote:

Benjith Sam wrote:

Hi Shubham,

I created a small demo app covering your requirement, hope this will help you in some way.

PFA - includes .oml solution file

check this:  Demo App


Hope this helps you!


Regards,

Benjith Sam

Hi Benjith 

The above given solution works if I am putting a url of file on another server. We want to show a doc which is  in the resource folder.And I am not sure whether I am giving the correct url or not. 

Can you please give the proper sequence of url ?


Thanks and Regards

Shubham Agarwal



Hi Shubham,

In the attached .oml solution, if you observe the defined IFrame is referring  the document file from Resource Directory of the same environment not from the external env resource.

Syntax

https://docs.google.com/viewer?embedded=true&url=ResourceURL


Resource Url: Environment_Path + Resource_File_Runtiem_Path


SyntaxEditor Code Snippet

https://docs.google.com/viewer?embedded=true&url=https://sbsam.outsystemscloud.com/TestMe/Sample.docx


For more reference: https://stackoverflow.com/questions/9193144/how-to-open-specific-page-on-googles-docs-viewer


Hope this helps you!


Regards,

Benjith Sam

Hi Benjith,

It is working with a lag. There are two problems:

1.) When I am trying to open it first time in incognito window, it is not opening. But when I reload it again it is opening. Are you also facing this issue? If yes , please suggest some solution.

2.)  Is there any limit on the size of document we can open using iframe and it is different for different formats like doc or docx because some of my files are opening and some are not?



Thanks and Regards

Shubham Agarwal



Solution

Hello Shubham,

So basically we decided to do a Skype call to address the problem and it worked afterwards.


Here's a summary:

  • The goal was to download a file and open it in the device. The file was stored in the Resources folder of the eSpace.
  • To achieve this, we decided to use the File Plugin. The SaveFile client action allows to save a file into a specific directory.

                                                                 

  • This action receives the BinaryData and the Path as input parameters. Since the file was uploaded to the Resources folder, we had no problem accessing to its binary content.

                                                       

  • After, we defined the Path parameter according to the device platform (iOS or Android)

            For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

            For Android: $parameters.FilePath = "Documents"; (Documents Directory)

  • Finally, we used the OpenDocument client action from the File Viewer Plugin to open the document in the device, using the URI output parameter from the SaveFile action as an input parameter.

                                           



Kind regards,

Rui Barradas

Solution

Rui Barradas wrote:

Hello Shubham,

So basically we decided to do a Skype call to address the problem and it worked afterwards.


Here's a summary:

  • The goal was to download a file and open it in the device. The file was stored in the Resources folder of the eSpace.
  • To achieve this, we decided to use the File Plugin. The SaveFile client action allows to save a file into a specific directory.

                                                                 

  • This action receives the BinaryData and the Path as input parameters. Since the file was uploaded to the Resources folder, we had no problem accessing to its binary content.

                                                       

  • After, we defined the Path parameter according to the device platform (iOS or Android)

            For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

            For Android: $parameters.FilePath = "Documents"; (Documents Directory)

  • Finally, we used the OpenDocument client action from the File Viewer Plugin to open the document in the device, using the URI output parameter from the SaveFile action as an input parameter.

                                           



Kind regards,

Rui Barradas

Thanks Rui


Hello Rui, 


For some reason the pictures you have uploaded in your solution dont seem to display, Can you upload them again if you have time?


I have raised a similar issue in https://www.outsystems.com/forums/discussion/59939/file-viewer-plugin-version-1-0-3-os11-doesnt-work-with-android/

But after setting the Path to "Documents" for Android, the file still wont open. Wonder if I have done anything wrong. 

Hello Christopher,

If you want, message me directly and I will try to send you the pictures.

Anyways, I will look into your issue as soon as I can.


Kind regards,

Rui Barradas