Some test text!


Get started

Download PDFTron SDKIntegrate with GradleIntegrate manuallyRun samplesAdd PDFTron license keyQuick start - view a documentProGuardUpdate to latest versionTroubleshooting

Document Viewer

OverviewShow a document in an ActivityShow a document in a FragmentViewer configurationDay and Night themesOpen from online URL

Document Viewer components

PDFViewCtrlReflowFloating context menuCustomize floating context menuAnnotation toolbarAnnotation style editorCustomize annotation style editorPage sliderAnnotation listDocument outlineUser bookmark listList containerThumbnail browserAdd pages dialogRotate pages dialogView mode dialogCrop pages dialog

Annotation and collaboration

ToolManager setupRead only modeDisable annotation creation/editingDefault annotation propertiesAnnotation propertiesEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaboration

Advanced customization

Add a custom view to a pageCreate a custom toolPage coloring modePage fit modePage layout mode


Convert documents to PDFConvert HTML to PDF


Text search

Other Frameworks


Advanced topics

Understand coordinatesDocument savingDocument lockingGenerate page thumbnailsTool class hierarchy


System RequirementsRun project in Android StudioRun project with source codePDFTron full vs. standardLocalizationIcon cheat sheetReduce size of APKEnable multidexOut of memory when rotating device multiple timesReduce memory consumptionDetachCurrentThread warning

PDF Processing API

What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling
Open from online URLkeyboard_arrow_down

Open from online URL

In this document
chevron_rightMake a linearized PDF document
chevron_rightByte-range requests
chevron_rightOpen an online PDF document

Online PDF can be viewed the same way as one can stream an online video. For example, 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. Showing partial PDF content while downloading on demand provides fast and responsive PDF viewing experience. While most viewers require the entire file to be downloaded before it can be opened and viewed, with PDFTron technology, viewing partial content for online PDF is made simple.


Due to the variety of PDF files and their hosting source, not every PDF can be viewed before the entire file is downloaded. To make this happen, the following are required:

  • A linearized (fast web view) PDF document.
  • A web server that supports byte-range requests (otherwise known as byte serving).
  • PDFTron's OpenUrlAsync method.

linkMake a linearized PDF document

A linearized document has two important properties:

  1. Its internal structure is organized so that pages are arranged from beginning to end and a page's data is all in the same area, and
  2. the document has a "linearization dictionary" and "hint tables" that list the location and size of all internal objects at the beginning of the PDF file

PDFTron SDK can linearize new and and existing PDF documents when they are saved. Once you have a PDFDoc object (by either opening an existing PDF or creating a new one), it can be saved with the e_linearized flag, for example:

Another potential option is to use Acrobat to save a document for "Fast Web View", which will also linearize a document.

linkByte-range requests

Secondly, a web server that supports byte-range requests is required. A byte-range request asks the server to send a certain set of bytes from a file that don't necessarily start from byte zero or comprise the entire file. For example if the HTTP GET headers include the following key value pair

Range: bytes=1495454-1594723

~97 KB will be sent from the requested file by a byte-range supporting server, starting at byte 1495454.

To test whether your webserver supports this feature, use cURL on your favourite *nix system (or using the native Windows version) as follows:

curl -H Range:bytes=16- -I

If the server responds with

HTTP/1.1 206 Partial Content

then it supports byte ranges. (If it responds with “HTTP/1.1 200 OK”, then it does not support byte ranges.)

A couple of small notes:

  1. If you're storing documents on SharePoint, caching needs to be enabled to enable byte-range requests.
  2. If you are serving documents stored in a database served via dynamic web pages, it may not support byte-serving in this specific case. A solution would be to temporarily save the file to a static URL that can then be used for byte serving.

linkOpen an online PDF document

With a linearized PDF and a webserver that supports byte-range requests, use the following to view the online PDF:

Using DocumentActivity:

Using PdfViewCtrlTabHostFragment:

Using PDFViewCtrl:

And that is it! You will see the document starts to show up shortly after.

As more and more data heads to the cloud, it's important that information that is stored remotely can be accessed in a fast, responsive manner. Using linearized PDF documents with PDFNet's OpenURL method is a way to deliver a top-notch remote PDF viewing experience.