Skip to main content

PreviewAnyFile

Whatever the file is PDF document, Word document, Excel, office document,zip archive file, image, text, html or anything else, you can perform a preview by this cordova Plugin to preview any file in native mode by providing the local or external URL.

Requires Cordova plugin: cordova-plugin-preview-any-file. For more info, please see the previewAnyFile plugin docs.

https://github.com/mostafa-mansour1/previewAnyFile

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation#

$ npm install cordova-plugin-preview-any-file
$ npm install @ionic-native/preview-any-file
$ ionic cap sync

Supported Platforms#

  • Android
  • iOS

Usage#

React#

Learn more about using Ionic Native components in React

Angular#

import { PreviewAnyFile } from '@ionic-native/preview-any-file/ngx';
constructor(private previewAnyFile: PreviewAnyFile) { }
...
this.previewAnyFile.preview('file://filepath.ext')
.then((res: any) => console.log(res))
.catch((error: any) => console.error(error));