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.

Prerequisites

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

The Criteria

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

The Classic Solution: ACTION_VIEW

The preview of this section is en route to Mars.

The Really Bad Idea: Google Docs

The preview of this section was eaten by a grue.

The Built-In Option: PdfRenderer

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

The Thunder Lizard Choice: PDF.js

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

The Native Approach: Pdfium

The preview of this section was abducted by space aliens.

What To Choose?

The preview of this section was last seen in the Bermuda Triangle.