Linearized PDF files


Learn about JPedal Java PDF Viewer

What are Linearized PDF files?

Linearized PDF files are specially organized PDF files designed to display before the PDF file has finished loading. Ordinary PDF files cannot be displayed until the whole file is available which can cause issues if the file is being accessed from the Internet.

 

How to tell if a PDF is linearized?

If a file is linearized, the word (linearized) will appear in the title bar of the JPedal viewer. If you open the PDF in Adobe Acrobat, it will show that the PDF has a fast web view in properties. There is an article explaining this in more detail.

Access a Linearized PDF file (PDF Viewer examples)

If you are using the JPedal Java PDF Viewer, all the work is done for you. If you open a file as a URL, JPedal will open the file and check to see if it is Linearized, popping up the display as soon as the Linearized part has loaded.

Linearized file functionality in PdfDecoder or PdfDecoderServer class

Example code for using linearization  in your own code

If you are using the PDFDecoder or PdfDecoderServer object and wish to use Linearization, there is sample java code showing how to access it in the example Commands file.

Viewing other pages in a PDF Linearized file

Acrobat is able to jump to any PDF page in a Linearized PDF file. Java does not have support for this flexiblity, so JPedal cannot jump to any page. However, JPedal is able to track which page data has now been loaded and display those pages. This is done automatically for you in our PDF Viewer. If you wish to add it to your own java code, here is how to see if the PDF page is available.

//if loading on linearized thread, see if we can actually display
//if non-linearized or linearized and loaded, always returns true
if(!decode_pdf.isPageAvailable(pageNumber)){
	currentGUI.showMessageDialog("Page "+pageNumber+" is not yet loaded");
    return;
}