Table of Contents
This plugin will open a file on your device file system with its default application.
GitHub Source Code: https://github.com/pwlin/cordova-plugin-file-opener2
Requires Cordova plugin:
cordova-plugin-file-opener2
Supported Platforms #
- Android
- iOS
- Windows
- Windows Phone 8
Usage #
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
constructor(private fileOpener: FileOpener) { }
...
this.fileOpener.open('path/to/file.pdf', 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
this.fileOpener.showOpenWithDialog('path/to/file.pdf', 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));