I tried to work with ionic/cordova plugin here.
So I put this code in my Page:
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); }
And a simple button to launch it in the html page:
<ion-content> <button ion-button round (click)="showDocument()"> Read </button> </ion-content>
But I can't see anything in the emulator (since it is not possible to run it on the browser)
Ionic Info is there:
UPDATE:
This is what I get when debugging with my device and chrome devtools:
UPDATE 2:
I have tried to work with absolute paths but I have got null value, I have made those changes:
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)
But see what I have got:
0 comments:
Post a Comment