How to open PDF file included in assets folder in Ionic 2?
2 answers
There are several ways to do this.
- InAppBrowser
- Thematic browser
- Viewing documents in Sitewearts format
- Built-in PDF viewer
You can find cordova plugins for all of the above situations. Please read the article below to find out more.
Git repo: PDFExample
+1
source to share
I am using this code and it works for me.
He needs a plugin.
showDocument(){
const options: DocumentViewerOptions = {
title: 'My PDF'
}
const imgeLocation = `${cordova.file.applicationDirectory}www/assets/imgs/${'Jainbhajan-Jeevan-Saar-By-Nirmal-Gangwal-1-ilovepdf-compressed (1).pdf'}`;
this.document.viewDocument(imgeLocation, 'application/pdf', options)
}
0
source to share