Wednesday, February 22, 2012

Anroid PDF Widget - As on Date 02/22/2012

As of 02/22/2012 there is no widget/Android View available in Android SDK which could simply render/display a .pdf file in an standalone app. The alternative way one can work are:

1. If its only about viewing - Then Install a 3rd party PDF Viewer App like that of Adobe's PDF Viewer or any other similar PDF Viewing application and then from within your app with the help of Intents launch the file by giving a URI in an OnClick Listener() which essentially will look up for any applications present on the device with a capability of displaying a PDF.

Make sure to catch the exception and display appropriate message to the user, in the event when there are no PDF Viewing applications present on the device.

2. Saving PDF's locally in a standalone app - Get the PDF data in the form of bytes, store it in a persistent database and then form the pdf and launch for display(the way it has been described in the first point).

3. Or write an application similar to PDF Viewing application as one by Adobe's.

Note - iOS although has a capability of displaying a .pdf file in a webview and renders just fine. However upon launching a PDF in an Android Webview or a WebBrowser, a user ends up downloading it to the mobile device's disk space instead of displaying it. This is just how the Android Browser/Webview behaves in the case of PDF's.

1 comment:

  1. Hi Saurabh,

    I hope all is well.

    Are you currently available in the JOB market? I have a perfect REMOTE JOB opening matching your skills set.

    If you’re available, do share the best NUMBER to reach you and EMAIL ID to share the JD.