ionic how to open pdf file and see in device for both ios and android

hybrid Dev picture hybrid Dev · Apr 18, 2017 · Viewed 9.9k times · Source

I have one pdf url. When i try to open its working in browser. But when i try to open in both android and ios device. My pdf file is not opening to see. Here my code :

My Controller :

$window.OpenLink = function(link) {
    window.open( link, '_system');
  };

My html code on-click:

<div  class="col col-50 clsGrid" onclick="OpenLink('http://www.orimi.com/pdf-test.pdf')">

Please help me out. How can i open my pdf file and see in both android and ios device.

Thanks in advance !!

Answer

Edison picture Edison · Apr 18, 2017

install plugin

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

then try this

<a class="item" href="#" onclick="window.open('http://www.orimi.com/pdf-test.pdf', '_system', 'location=yes'); return false;">
  Open pdf
                </a>