PDF external url


How to open pdf by external url within app in android platform e.g localhost:8080/document/chapter.pdf

Thanks in Advance


there are multiple ways like the cordova plugin fileOpener2, which tries to find an app on your device which can handle the given file/format.

or you can try the inapp-browser plugin and open a new window with _system as target.

But if you really want to open a pdf in your app you need some additional libs like:

or build on top of mozillas pdf.js:


thanks Benglter, i will try pdf.js library then inform you about the result.


I am testing sample https://github.com/jeffleus/ionic-pdf.
This is working on chrome but it is not working on device.
need your help bro …


if you are using pdfmake:

The download functionality does not work on mobile devices. use the Cordova File-Plugin to write the pdf somewhere on your device like documents on iOS --> from there you can open it with the FileOpener2 Plugin (this searchs for an app on your device, to open the file)


Assuming that you’re running on an Android device, what does “adb logcat” show, does it show any errors? I have an app which successfully opens/displays a PDF stored at an external URL (Amazon S3) using InAppBrowser and FileOpener.


using cordova file opener, it is work on browser but not on device.
device model is samsung galaxy s2
and code is:
).then(function() {
}, function(err) {
alert('An error occurred: ’ + JSON.stringify(err));
console.log('An error occurred: ’ + JSON.stringify(err));


Galaxy S2 is very old, what version of Android is it running? Ionic only supports Android 4 or higher.

Anyway, it works for me on my Galaxy S3 device, but on iOS you need to use another “file opener” plugin. So this is what I ended up with:

      var chooseFile = function () {
        var deferred = $q.defer();

        // iOS (NOTE - only iOS 8 and higher): https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin
        if (ionic.Platform.isIOS()) {

            function (uri) {
              chooseFileOk(deferred, uri);
            function (error) {
              chooseFileError(deferred, 'FilePicker');

        // Android: https://github.com/don/cordova-filechooser
        } else {

            function (uri) {
              chooseFileOk(deferred, uri);
            function (error) {
              chooseFileError(deferred, 'fileChooser');

        return deferred.promise;

      function chooseFileOk(deferred, uri) {
        $log.log('FileManager#chooseFile - uri: ' + uri);


      function chooseFileError(deferred, source) {
        $log.debug('FileManager#chooseFile - ' + source + ' error: ' + JSON.stringify(error));

        // assume operation cancelled


First of all Thanks for your reply
you are right galaxy s2 is very old because when i run this code on s4, it is working but not on s2.
but application requirement, it is work on atleast 4.1 android api and s2 which is currently i used its api 4.1 but"file opener" plugin not work on it. i do’t know what is the reason
need your help bro …


Aha I see,it does work on the S4 (and on my S#) but not on the S2.

So what does “adb logcat” tell you then?


Maybe you can try with crosswalk…


hi …
how to pick only pdf or doc file and upload it to remote server in ionic.
is there any plugins are there
thank you


Crosswalk solves a huge number of device specific problems, installed it today and it solved 3 problems in one go.


Like @fabioferrero said try Crosswalk, big chance it will fix your problem.