Open and print PDF files on Android


#1

Hi, I’m using cordova-plugin-document-viewer to view and print PDF files which works great on iOS but I cant get it to work on Android.

I have a file pdfs where all my PDF files are, I have pdfs added in my Manifest.
I also have MuPDF installed and Adobe Acrobat on my device.

If I use:

cordova.plugins.SitewaertsDocumentViewer.viewDocument("pdfs/test.pdf","application/pdf",{title: "Test PDF File", print: {enabled: True}});

I get the error =
Error in SitewaertsDocumentViewer.viewDocument(): invalid file url ‘pdfs/test.pdf’ or no viewer for mime type ‘application/pdf’

If I use:

 cordova.plugins.SitewaertsDocumentViewer.viewDocument("file:///android_asset/pdfs/test.pdf","application/pdf",{title: "Test PDF File", print: {enabled: True}});

I get the error=
sitewaertsdocumentviewer.js:302 Error in SitewaertsDocumentViewer.viewDocument():
Object > message: “File not found”


#2

Where is the pdf’s folder? Under www or elsewhere?


#3

I’ve put the PDF folder under Project 1 > pdfs and included it in my manifest. I also put the the test.pdf file in images and tried that but it didnt work.


#4

I also tried

but got error:
exposed beyond app through Intent.getData()


#5

It seams this plugin works if I target android 23, but not target 25.


closed #6

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.