0

I'm working on an Android app that (ideally) will download PDF files and display them without leaving the app and going to a viewer application.

This Stack Overflow question solves this problem, but forces users to leave the app and open a 3rd party application (which users would have to download) to see the PDF. This is definitely not ideal: I want to accomplish this within my own app.

Some details that might help:

I'm building the app with Phonegap (also called Cordova), which means all of my code is in html and javascript, but it compiles natively to the Android. This means that if there is a javascript library that allows web browsers to display PDFs, my app will be able to display them too. I've looked over the jsPDF library, which allows programmers to create new PDFs using html and javascript and display them in a webpage. However, I don't want to create a new PDF, just display one that already exists; it doesn't seem like jsPDF has an option for this. Is there a similar library that might work?

Phonegap can also access the Android's in-app web browser, but I don't think this browser can view PDFs. However, it's possible there's a plugin to this browser that would enable it to do so... Has anyone heard of one?

Any other ideas would be welcome. I'm stuck on this :/

Community
  • 1
  • 1
NcAdams
  • 2,521
  • 4
  • 21
  • 32

1 Answers1

0

Try a rendering library like pdf.js to view the pdf in your app.

Another alternative is - assuming your app user will have/need internet connectivity - using the online Google Document viewer functionality in combination with Phonegap's InAppBrowser plugin like in this StackOverflow answer.

Community
  • 1
  • 1
EeKay
  • 6,494
  • 3
  • 24
  • 24