3 Replies Latest reply on Dec 1, 2016 7:50 PM by kerrishotts

    Show pdf after download

    de Wit, Peter

      I want to display a pdf file that I stored :

       

        var cNaam = 'Ma.pdf';

        var url = 'http://wis-mine.nl/Info/' + cNaam;

        var filePath = 'file:///mnt/sdcard/Info/Info/' + cNaam;

        var fileTransfer = new FileTransfer();

        $.mobile.loading( "show" );

        fileTransfer.download( url, filePath, function ( entry ) { openPDF( cNaam ); }, function ( error) { alert(error); }  );

       

      This is working, but how get I display the pdf file in adobe reader, using a Samsung Note2.

       

      What can I do c.q. what's missing :

       

      function openPDF(file)

      {

      //  cordova.file.open( "/sdcard/Info/Info/"+ file,"application/pdf" ); // this is the old way before 15nov 2016

       

        cordova.plugins.FileOpener.openFile("/sdcard/Info/Info/"+ file, onSuccess, function( onError) {alert(onError);});

       

        return false;

      }

       

      Can somebody help me?

        • 1. Re: Show pdf after download
          kerrishotts Adobe Community Professional

          What specifically is the problem? I'm guessing you were using an old version of a plugin that let you open the PDF (given the date in your comment), but what plugin & version are you trying & what error(s) (if any) are you getting?

          • 2. Re: Show pdf after download
            de Wit, Peter Level 1

            This is the config.xml :

             

            <?xml version="1.0" encoding="UTF-8"?>

            <widget xmlns = "http://www.w3.org/ns/widgets"

              xmlns:gap = "http://phonegap.com/ns/1.0"

              id = "com.pbdewit.infoEm"

              versionCode="3.0.1"

              version = "3.0.1">

              <name>Info</name>

              <description>Emmerich Info</description>

              <author href="" email=""></author>

             

              <preference name="phonegap-version" value="3.7.0" />

              <preference name="orientation" value="portrait" />

              <preference name="fullscreen" value="true" />

             

              <platform name="android" />

             

              <plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />

              <plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0" />

             

            </widget>

             

            The problem is that after the file is stored on the telephone, notting is comming up screen in adobe reader.

            • 3. Re: Show pdf after download
              kerrishotts Adobe Community Professional

              You're using a very old version of PhoneGap -- you need to upgrade, now. That version has serious security issues and the app stores may reject you if you try to submit using that version.

               

              You aren't including the file opener plugin your your config.xml file, so I'm guessing it isn't installed and isn't getting initiated by Cordova when your app starts.