[英]how to open an Offline pdf in ionic 2 application in adobe reader
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. 尝试下面的代码在离子2应用程序中打开离线pdf但代码是在cleverdox查看器而不是adobe reader打开pdf文件,我怎么能默认设置adobe reader来使pdf功能化。 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. @ rj7代码的问题在于他将一个函数添加到应该是嵌套对象的内容中。 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
有关可以使用此功能的选项的更多信息,请参阅以下URL: https : //github.com/sitewaerts/cordova-plugin-document-viewer
Hope that helps to anyone stuck in the future. 希望有助于未来的任何人。
Try openWith() like below, 尝试下面的openWith(),
open()
{
const options: DocumentViewerOptions = {
title: 'My PDF',
openWith() {
enabled: true
}
}
this.document.viewDocument('file:///android_asset/www/assets/test.pdf', 'application/pdf', options)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.