[英]how to open an Offline pdf in ionic 2 application in adobe reader
嘗試下面的代碼在離子2應用程序中打開離線pdf但代碼是在cleverdox查看器而不是adobe reader打開pdf文件,我怎么能默認設置adobe reader來使pdf功能化。 提前致謝。
open() { const options: DocumentViewerOptions = { title: 'My PDF' } this.document.viewDocument('file:///android_asset/www/assets/test.pdf', 'application/pdf', options) }
不知道你是否解決了這個問題,但是這就解決了我的問題:
確保您使用的是最新版本的文檔查看器插件。
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);
}
@ rj7代碼的問題在於他將一個函數添加到應該是嵌套對象的內容中。 有關可以使用此功能的選項的更多信息,請參閱以下URL: https : //github.com/sitewaerts/cordova-plugin-document-viewer
希望有助於未來的任何人。
嘗試下面的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.