The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Viewing PDFs

The Portable Document Format — better known as PDF — has been around for over two decades, and it is still going strong today. As a result, we often have a need to show PDF files to users, whether those files are:

This is another one of those topics that seems fairly simple on the surface, but can get complicated based on your requirements. In particular, if you want to try to present the PDF to the user in your app, as opposed to launching some external PDF viewing app, while you have a few options, they all have their issues.

In this chapter, we will review several ways of displaying a PDF to the user, so you can choose what approach (or approaches) are the best fit for your requirements.


Understanding this chapter requires that you have read the core chapters of this book.

The Criteria

The preview of this section was lost due to a rupture in the space-time continuum.

The Classic Solution: ACTION_VIEW

The preview of this section was traded for a bag of magic beans.

The Really Bad Idea: Google Docs

The preview of this section was fed to a gremlin, after midnight.

The Built-In Option: PdfRenderer

The preview of this section will not appear here for a while, due to a time machine mishap.

The Thunder Lizard Choice: PDF.js

The preview of this section is sleeping in.

The Native Approach: Pdfium

The preview of this section is in an invisible, microscopic font.

What To Choose?

The preview of this section is sleeping in.