IONIC 4 View Documents inside App, works on WEB but not on ANDROID and iOS

Hello guys, I hope you all doing well.

I have an IONIC 4 APP that i need to load document files from storage using API. I have managed to open IMAGES, WORD Documents, PDFs on WEB, but I am Struggling on iOS and Android.

On iOS files are opened but only the first page, can’t scroll on different pages, while on Android it shows blank page, this goes with word documents and pdf files, images are opening well, while on web when running ionic serve it is all working well.

For this I have used iFrame, I am opening files via DomSanitizer using URLSearchParams bypassSecurityTrustResourceUrl, I also need to do pinch and zoom on iFrame but that cant seem to be possible.

If you have any other that you suggest that would also be worth a try please let me know.

This is iFrame.html:

<div class="iframe-fix">

and this is .ts file of the iframe:

iFrameFileSelected: SafeResourceUrl | SafeHtml | SafeStyle | SafeScript | SafeUrl  = null;

  params: any = {
    id: null,
    uuid: null,
    token: null

constructor(protected sanitizer: DomSanitizer) {
  this.iFrameFileSelected = this.sanitizer.bypassSecurityTrustResourceUrl(this.getMedia + paramsii);

Thank you very much.

This is with ionic Serve

This is running app on Android

This is on iOS

1 Like