I don’t know about you, but I have had multiple clients request a PDF viewer in their app. Personally, I am not a huge fan of PDF’s but they serve their purpose. Below are 3 examples of ways to add a PDF viewer to your Titanium Mobile application.
The easy way
Did you know Google Apps has a fantastic little service for viewing PDF files? As you might have guessed, based on the title of this blog post, it also allows you to view a PDF. It does not seem to work in the Ti.UI.webView. However, using openUrl seems to work quite well.
Android Intents for local files
If you would like to use Android intents for viewing local PDF files saved on the device, Tony Lukasavage has a great blog post about sharing information between intents. Remember that if you want to display a remote pdf file you will need to download and save it first to the external storage device before you can invoke the intent to view it.
(Sharing project assets with Android intents)[http://www.appcelerator.com/blog/2011/09/sharing-project-assets-with-android-intents/]
With this one, “there are a few, uh, provisos. Ah, a couple of quid pro quos.” One, I have never used this module and can’t guarantee it will work. There is only one 5 star review so take it with a grain of salt. Two, it cost $15.99 per year. With those two items out of the way, have at it. That said, it is the only way I have seen to view a PDF within your app.
As you can see PDF’s on Android are a little tricky. If you have any thoughts on how to add a PDF viewer or if there is a method or module I am missing please post it in the comments below so that I can add it.