116
Views
5
Comments
Alternatives to display uploaded PDF inside android app
Application Type
Mobile
Service Studio Version
11.14.3 (Build 56735)

Hi everyone,

I'm working on a mobile app and I looking for a way to display a PDF file directly from inside the app (not opening the file in another app of the phone) and considering that the PDF was uploaded also from the app (from a pdf file that was already on the phone).

I've been trying several options but I still can't manage to get de PDF displayed inside the app, here's what I have:

  • The only way that I have been able to actually view a PDF file inside the app is by using an Iframe with a PDF file preloaded in the resource file and displaying it with Google docs PDF viewer. The thing is that I would need a way to dynamically save/load file in the resource folder and I'm understanding it cannot be done

Here's is an example of this

It looks like this on the phone


  • I've also tried using an Iframe to display the PDF, stored in a local DB, with the Base64 information of it. This works when I use it in windows with the app emulator, but when I try it directly on the android phone, the pdf doesn't get displayed.

Here's the detail of this

it looks like this on the phone


  • The last thing I'm trying is a mix of the first point, using Google Docs viewer, but with the URL of the pdf file stored in the device's memory (something like "file:///storage/emulated/0/Android/apps.../myfile.pdf") but the pdf is also not shown in the iframe.

It looks like this on the phone



Any idea on how to get this done?,  maybe some work with Resources folder files? or some twist around Google docs viewer and internal storage files/URL

Thank you!!


2022-03-03 22-15-30
Borislav Shumarov PhD
Champion

I had a similar issue, but for Reactive.

You can check these two components, they should work with BinaryData:

https://www.outsystems.com/forge/component-overview/10749/binary-viewer-mobile

https://www.outsystems.com/forge/component-overview/10446/binary-base64-data-to-pdf

Hope they help!

UserImage.jpg
Diego Boettiger

Hi @Borislav Shumarov ,


Thanks for your help. unfortunately, it doesn't seem to cover my issue  :(

- Binary view mobile seems to use file management to locate the PDF file and open it outside the application, it only has some preview methods for the app for IOS, and I'm trying to do this for Android

- Binary base 64 to pdf uses javascript to show an image of the PDF (you can change the size directly in the javascript), it won't have the image quality or zoom quality that a PDF file can have.

2021-06-02 20-50-04
Márcio Carvalho

Adding some more useful tips...

Check this post, which has some possible components that might help you, provided by @Daniël Kuhlmann.

https://www.outsystems.com/forums/discussion/67588/trying-for-displaying-pdf-in-mobile-using-iframe-it-not-working-on-mobile-device/

Regards,

Márcio


UserImage.jpg
Diego Boettiger

Hi @Márcio Carvalho , I've just replied Daniël's post, it seems that none of the alternatives presented cover what I need, all those extensions/components or open the PDF file outside the application or allows to preview it from a web URL of the PDF which I won't have because it has to be stored locally on the phone (internal memory and/or binary data)... :(

2021-06-02 20-50-04
Márcio Carvalho

That's a bummer. Feel sorry for that. Sorry for those links didn't help you.

Can you please just check this three posts? I have never done that in mobile so I can crrat a solution by myself to really help you just sharing some posts that I find it interesting.

https://www.outsystems.com/forums/discussion/38330/opening-pdf-in-local-storage-with-file-viewer-plugin/

https://www.outsystems.com/forums/discussion/34028/mobile-offline-open-pdf-from-entitys-binary-data/

https://www.outsystems.com/forums/discussion/35700/open-a-pdf-that-arrives-in-base64-mobile-app/

Regards,

Márcio

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