Wouldn’t it be nice to be able to view a remote PDF the same way as one can view an online video? By this we mean you can see the beginning of the content almost immediately, and if you move to the middle of the content, it is prioritized and loaded very quickly, before other parts.
Unfortunately, with remotely stored PDFs, this is not how things usually work. What typically happens is that the entire file must be downloaded before it can be opened and viewed. This is the case for two reasons:
- PDF documents are not typically linearized (or in Adobe lingo “fast web view”ed). This means that the contents of page twenty, for example, can actually be located in many different places within the file, with no way of being able to quickly determine where the different pieces are. Without this information, the entire document must be downloaded before page two can be displayed.
- Even if a document is linearized, most viewers are not equipped to show partial content. They are designed to work on complete documents and will reject partial documents as corrupted.
There is, however, a better way.
If you’re building a website or HTML5 app, see this post for how to display a PDF in HTML. If you’re building a native program for desktops (Windows, Mac, Linux) or mobile (iOS, Android, WinRT, Windows Phone 8), then read on…
PDFNet Mobile SDK for Android brings the full power of the PDFNet library to Android devices. The SDK ships with simple to use Java APIs that allow developers to seamlessly integrate PDF viewing, creation, searching, annotation, and editing capabilities with their Android apps. This document will explain how to download the SDK, describe its basic components, step you through creating a simple PDF viewing app, and point you towards helpful resources. It is organized into the following sections:
Creating a basic PDF viewer
Adding support for Annotations, Text Selection and Form Filling
Opening encrypted documents
HTML5 apps offer many of advantages over native ones. Web apps are
- Naturally cross-platform: develop once, run on iOS, Android, Windows Phone and everything else.
- Easy to update the app for everyone, immediately.
- Do not have to go through Apple or Google to access customers (but you still can by embedding it into a native shell app)
But web apps suffer one big problem, and that’s the user experience.
Today, in 2013, even the best-crafted mobile web apps come nowhere near the quality of experience of the best native apps. In fact, with but a few exceptions, the best mobile web apps today still don’t approach the quality of the first batch of native iPhone apps from 2007.
— John Gruber, Daring Fireball
One area of the user experience where HTML5 apps have been historically weak is in their ability to display a PDF within the app. For a long time, “viewing” a PDF on the web meant downloading it, and opening it in a different program. Next came browser PDF plugins, that would take over the browser screen in order to display the PDF. A small improvement, but still not integrated and certainly not a good user experience.
So, if the goal is to integrate PDF viewing into a web app, how can that be done? There are a number of approaches, each with pros and cons. Keep reading to see what techniques exist, and which might be best for your app.