Reputation: 3189
I'm using Document Viewer Plugin to show pdf file in my ionic 3 app.
I placed a pdf file in assets folder and call the method as they mentioned in their documentation.
const options: DocumentViewerOptions = {
title: 'My PDF'
};
this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options)
but It won't show anything. I used another built in method of this plugin:
this.document.canViewDocument(url, contentType, options, onPossible, onMissingApp, onImpossible, onError)
it throws the onError callback function and error says:
'Relative URIs are not supported.'
Any help would be appreciated.
Upvotes: 3
Views: 2246
Reputation: 142
Use File Plugin Native Ionic and use:
this.file.applicationDirectory + 'www/assets/files/myFile.pdf
Upvotes: 1