How to open external pdf url in app

You need to whitelist that host name to make it work in cordova under iframe.

import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';

demoUrl: string = 'https://any pdf url ';

constructure (private inAppBrowser: InAppBrowser){
this.triggerInAppBrowser(this.demoUrl);
}

triggerInAppBrowser(url){
const browser: any = this.inAppBrowser.create(url, '_blank', 'location=yes');
 browser.on('exit');
}

In Lastest Veriosn on ionic, Iā€™m Getting Blank Screen image below:
I feel Iā€™m missing something please help me to figure out.

2 Likes

Follow the below blog and just make the url path dynamic and pass it from the html selected file

Hi, did you solved the issue? can you please help me. Iā€™m having the same issue

Use iframe to display the External PDF file in app

<iframe src="https://docs.google.com/gview?url=https://path.com/to/your/pdf.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>