Trying the below code to open an offline pdf in ionic 2 application but the code is opening a pdf file in cleverdox viewer instead of adobe reader, how could i set adobe reader by default here to make pdf functional. Thanks in Advance.
open() { const options: DocumentViewerOptions = { title: 'My PDF' } this.document.viewDocument('file:///android_asset/www/assets/test.pdf', 'application/pdf', options) }
No idea if you got this resolved but here's what fixed the issue for me:
Make sure you are using the latest version of the document Viewer plugin.
open() {
const options: DocumentViewerOptions = {
title: 'My PDF',
openWith: { enabled: true }, //this will allow you to open the document with an external application
// any more options
};
this.document.viewDocument('file:///android_asset/www/assets/test.pdf', 'application/pdf', options);
}
The problem with @rj7 's code is that he added a function into what should be a nested object. For more information on the options you can pull through into this function, see the following URL: https://github.com/sitewaerts/cordova-plugin-document-viewer
Hope that helps to anyone stuck in the future.
Try openWith() like below,
open()
{
const options: DocumentViewerOptions = {
title: 'My PDF',
openWith() {
enabled: true
}
}
this.document.viewDocument('file:///android_asset/www/assets/test.pdf', 'application/pdf', options)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.