9
我試圖與ionic/cordova plugin here一起使用。DocumentViewer未與Ionic 3配合使用
所以我把這個代碼在我的網頁:
showDocument() {
var options: DocumentViewerOptions = {
title: 'A book',
documentView: { closeLabel: '' },
navigationView: { closeLabel: '' },
email: { enabled: true },
print: { enabled: true },
openWith: { enabled: true },
bookmarks: { enabled: true },
search: { enabled: false },
autoClose: { onPause: false }
}
this.docViewer.viewDocument('assets/arabic.pdf', 'application/pdf', options);
}
和一個簡單的按鈕來啓動它的HTML頁面:
<ion-content>
<button ion-button round (click)="showDocument()">
Read
</button>
</ion-content>
但我不能看到任何模擬器(因爲它無法在瀏覽器上運行它)
離子信息有:
UPDATE:
這是我與我的設備和鉻devtools調試時:
更新2:
我曾嘗試以絕對路徑工作,但我有空值,我hav E製備這些變化:
import { File } from '@ionic-native/file';
declare let cordova: any;
//staff
pdfSrc: string = cordova.file.applicationDirectory + 'assets/arabic.pdf';
//staff
console.log(this.pdfSrc);
this.document.viewDocument(this.pdfSrc, 'application/pdf', options)
但是看看我有:
控制檯中的任何錯誤使用[遠程調試](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)? –
其實我對遠程調試沒有太多的想法。我將看到如何使用它 –
@HoussemBdr是您的點擊觸發器? – Webruster