19
Views
3
Comments
[File Viewer Plugin] Can not preview resource document with debug mode
file-viewer-plugin
Mobile icon
Forge asset by OutSystems
Application Type
Mobile
Service Studio Version
11.55.26 (Build 64206)
Platform Version
11.35.0 (Build 45040)

Hi guys,

I am trying to create one demo mobile app to test preview document with File Viewer Plugin. 

I am using the Android phone to do the test. And use the File Viewer Plugin Version: 3.0.1

I tried preview resource file first, after I create the app follow the document and publish it with debug type, it can work well in PWA mode. But when I run it in Native Platforms, it show me "The file you are trying to open does not exist." 


Does anyone know the root cause and what I missed? 

Thank you 



1eb57e1ee9d4ecf7e0da134a0237f663_compress.jpg
Document preview action.png
2025-12-09 14-11-18
Janakiraman JR

Hi Xuehe,

When testing in PWA mode, resources are available as expected because they are loaded as part of the web context. However, in native mobile apps, resource files are handled differently. The issue likely comes from how and where the resource is being stored or referenced. The File Viewer Plugin expects the file to exist in the device’s file system, not just as an OutSystems resource.

Your app needs to move or access the file from the native file system, not just treat it as a web resource. The error message means the file viewer can’t find it at the expected native path. 

In native mode, you must manually copy the resource to the local file system before you can view it with the plugin. Follow the below steps

  • Mark the resource as "Deploy to Target Directory" in OutSystems.

  • Use the File Plugin (Cordova plugin) to copy the resource file from the application bundle to the device's local file system.

  • Once copied, pass the full path to the File Viewer plugin.

UserImage.jpg
Xuehe Liu

Hi JR,

Thanks for you reply.

As this is my first mobile app, so maybe I will make some elementary mistakes.  Thank you for your patience.

1st, I set the resource as "Deploy to target directory" follow the guide document.

But I did not use File Plugin to copy the resource file, does this is required? And it is the best practice? How should I define the path where the file is saved in the device?

Thank you.


Resource setting.png
Url setting.png
2025-01-10 11-40-52
Pedro Gustavo Bilro

Hey Xuehe, thanks for posting this.


You should not need the File Plugin to copy the resource to a different folder, as the File Viewer Plugin takes care of that internally.


According to the docs (https://success.outsystems.com/documentation/11/integration_with_external_systems/mobile_plugins/file_viewer_plugin/#working-with-app-resources), you need to use "Deploy to target directory" and target directory must be "resources". Then, you should call the "OpenDocumentFromResources" client action using "resources/<your_resource_file_name_and_extension>".


Also, you need to perform a new mobile build after you add the resource file in your OutSystems app, because otherwise it won't be available natively.


Hope this helps.

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