Document Viewer is not working


#1

my code is

 const options: DocumentViewerOptions = {
      title: 'My PDF'
    }
    this.document.viewDocument('assets/help_guide.pdf', 'application/pdf', options)

and error I am getting is

[17:37:25]  error opening ws message: {"category":"console","type":"log","data":["Error in
            SitewaertsDocumentViewer.canViewDocument(): ",{"status":9,"message":"Relative URIs are not
            supported.","details":"java.lang.IllegalArgumentException: Relative URIs are not supported.\n\tat
            org.apache.cordova.CordovaResourceApi.assertNonRelative(CordovaResourceApi.java:452)\n\tat
            org.apache.cordova.CordovaResourceApi.getUriType(CordovaResourceApi.java:105)\n\tat
            org.apache.cordova.CordovaResourceApi.mapUriToFile(CordovaResourceApi.java:150)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getFileNew(DocumentViewerPlugin.java:852)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.getFile(DocumentViewerPlugin.java:842)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.canGetFile(DocumentViewerPlugin.java:679)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.doExecute(DocumentViewerPlugin.java:352)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin.access$000(DocumentViewerPlugin.java:49)\n\tat
            de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin$1.run(DocumentViewerPlugin.java:185)\n\tat
            java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)\n\tat
            java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)\n\tat
            java.lang.Thread.run(Thread.java:761)\n"}]}
[17:37:25]  console.error: Error in SitewaertsDocumentViewer.viewDocument():

#2

What Document Viewer are you referring to?


#3

#4

See here: https://github.com/sitewaerts/cordova-plugin-document-viewer/issues/83

Strange thing is that your code matches the docs example though. Maybe create an issue at the Ionic Native github repo.


#5

you can call as follows

const options: DocumentViewerOptions = {
      title: 'My PDF'
    }
    this.document.viewDocument('www/assets/help_guide.pdf', 'application/pdf', options)

#6

@erojas19 this is not working


#7

I have the same problem. did you solve it? I cant start reading my document


#8

the only document viewer that I found is the following. do you know other document viewer?
See here: https://github.com/sitewaerts/cordova-plugin-document-viewer/issues/83128


#9

thnx for information


#10

I tried a lot to run this plugin but cant get working. today I found a new angular package ng2-pdf-viewer. seems good.


#11

I have the same problem. did you solve it?