10
Views
6
Comments
Solved
Mobile Base64 pdf file to Image

Good Day Community,


I am trying to build a client action for an offline mobile application, the goal is to convert the local storage Base64 pdf file to an Image. I am trying to convert the data since I will be using the Image widget. 

Here is what I have done.

I tried to display the local Base64 pdf file directly using the HTML Encode Widget. On the mobile emulator of outsystems it works, however when installed as an apk it doesn't, read on some forums similar scenario.

I cannot use forge components which will prompt the pdf file to be displayed outside of the mobile application.

Any Ideas and documents will be highly appreciated. Thank you :) 

Rank: #95
Solution

Hello Leonard,

Hope you are doing well.


As suggested, here's what you can do:

1) Convert your file from Base64 to Binary Data using a client-side action. You can do that using JavaScript, doing something like:

2) Use SaveFile action from File Plugin to save your file (Binary Data) in the device.

3) Use OpenDocument action File Viewer Plugin to open this previous saved file (from its location that you can obtain from step 2).


Please be aware that the addition of a new plugin will always make you to generate your builds again and you are not able to test them on a browser, only using a real device.


Hope that this helps you! :)


Kind regards,

Rui Barradas

Champion
Rank: #147

Hi Leonard,

You can use JS libraries to achieve this. For example this one https://github.com/mozilla/pdf.js#online-demo 

Rank: #95
Solution

Hello Leonard,

Hope you are doing well.


As suggested, here's what you can do:

1) Convert your file from Base64 to Binary Data using a client-side action. You can do that using JavaScript, doing something like:

2) Use SaveFile action from File Plugin to save your file (Binary Data) in the device.

3) Use OpenDocument action File Viewer Plugin to open this previous saved file (from its location that you can obtain from step 2).


Please be aware that the addition of a new plugin will always make you to generate your builds again and you are not able to test them on a browser, only using a real device.


Hope that this helps you! :)


Kind regards,

Rui Barradas