Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Display PDF files in Android

Is there a way to display PDF files in Android? I have tried the examples using a webview, but only get a blank page. It seems PDF files are not supported by default?

Can I download and bundle some kind of framework with my application that will handle the display of PDFs?

— asked September 16th 2010 by Kjetil Rohde Jakobsen
  • android
  • mobile
  • pdf
2 Comments
  • I also need to display a PDF file in an android app. Has anyone found a method?

    — commented October 20th 2010 by Mike Hopkins
  • Why in the world do pdf docs open just fine in a webview for iOS but not for Android and Blackberry OS? This is very frustrating for developers trying to build cross-platform apps that handle pdfs. :(

    As I understand, it is the OS that is holding us back and not Titanium.

    — commented July 12th 2011 by Eric Whitlock

7 Answers

  • you can open it using third parity
    [Google viewer]
    (http://docs.google.com/viewer?pli=1)
    and then put the generated link in openurl

    — answered September 10th 2011 by Haya aziz
    permalink
    0 Comments
  • I created a Titanium module(in Java) that converts a pdf file into images (page by page), and saves it in the SDcard. Then created a reader layout using a Webview with next and previous buttons on top, to display these images page by page.

    — answered March 14th 2012 by Andrew Austin
    permalink
    1 Comment
    • P.S: I used AndPdf open source code as reference to create the module project.

      — commented March 14th 2012 by Andrew Austin
  • You'll need to integrate a native library. We are working to integrate PDFRender SDK with Appcelerator.
    I'll update you when ready.

    — answered August 14th 2012 by Dario Finardi
    permalink
    1 Comment
    • Has the PDFRender SDK been inlcuded yet?

      — commented May 28th 2013 by Craig Conover
  • if you need to open/view PDF file in your own app go to the marketplace Android PDF Reader. The demo is available to see how does it look like

    — answered December 24th 2013 by Ario Barzan
    permalink
    0 Comments
  • Well, hopefully Mike Hopkins found an answer already, but in case he didn't…

    If the user has a PDF reader, you can open PDFs using Ti.Platform.openURL() like this:

    Titanium.Platform.openURL('http://foo.com/bar.pdf');
    

    This also works for PDFs you have downloaded to the user's phone.

    — answered November 8th 2010 by Dawson Toth
    permalink
    0 Comments
  • You'll need to instruct your users to install a PDF reader. You can't bundle apps at this time.

    — answered September 25th 2010 by Don Thorp
    permalink
    1 Comment
    • Provided the user has a PDF reader installed, what next? The webview in Android doesn't seem to handle PDF mimetype.

      — commented October 20th 2010 by Mike Hopkins
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.