Framework v4 BETA

DocumentViewer

This plugin offers a slim API to view PDF files which are either stored in the apps assets folder (/www/*) or in any other file system directory available via the cordova file plugin.

Repo: https://github.com/sitewaerts/cordova-plugin-document-viewer

Installation

  1. Install the Cordova and Ionic Native plugins:
    shell
    $ ionic cordova plugin add cordova-plugin-document-viewer
    $ npm install --save @ionic-native/[email protected]
    
  2. Add this plugin to your app's module

Supported Platforms

  • Android
  • iOS
  • Windows

Usage

typescript
import { DocumentViewer } from '@ionic-native/document-viewer/ngx';


constructor(private document: DocumentViewer) { }

...
const options: DocumentViewerOptions = {
  title: 'My PDF'
}

this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options)


Instance Members

canViewDocument

Check if the document can be shown

Parameters

url

Type: string
Url to the file

contentType

Type: string
Content type of the file

options

Type: DocumentViewerOptions
See DocumentViewerOptions table below

onPossible

Type: Function
See Function table below optional

onMissingApp

Type: Function
See Function table below optional

onImpossible

Type: Function
See Function table below optional

onError

Type: Function
See Function table below optional


getSupportInfo

Displays the email composer pre-filled with data.


viewDocument

Opens the file

Parameters

url

Type: string
Url to the file

contentType

Type: string
Content type of the file

options

Type: DocumentViewerOptions
See DocumentViewerOptions table below

onShow

Type: Function
See Function table below optional

onClose

Type: Function
See Function table below optional

onMissingApp

Type: Function
See Function table below optional

onError

Type: Function
See Function table below optional


DocumentViewerOptions

autoClose

Type: reflection
undefined optional

bookmarks

Type: reflection
undefined optional

documentView

Type: reflection
undefined optional

email

Type: reflection
undefined optional

navigationView

Type: reflection
undefined optional

openWith

Type: reflection
undefined optional

print

Type: reflection
undefined optional

search

Type: reflection
undefined optional

title

Type: intrinsic
undefined optional