Search code examples
androidioscordovasencha-touch-2cordova-3

Reading Pdf, Doc, Ppt and xls files in android and ios using phonegap


I am searching for the way to open and read Pdf, Doc, Ppt and xls files in my hybrid app developed using Sencha Touch 2.4 with Phonegap (Android & Ios).

What i did so far

  1. I got to know by searching that Ios WebView supports Pdf, Doc, Ppt, But not on Android WebView. So i can't use WebView for both Android and Ios.

  2. Device need to work in offline So, i can't use google doc viewer.

  3. Tried cordova-plugin-file-opener2 File Opener, But always getting "Error status: 9 - Error message: File not found"

How can i achieve this ?


Solution

  • try with inAppBrowser plugin

    https://github.com/apache/cordova-plugin-inappbrowser

    for iOS use

    cordova.InAppBrowser.open('yourFileUrl', '_blank');
    

    for android use:

    cordova.InAppBrowser.open('yourFileUrl', '_system');