Q: Do Qoppa’s PDF components (jPDFViewer, jPDFNotes, jPDFEditor) support reading linearized PDF documents in an efficient way or is there another way to load PDF documents on demand for viewing from a web server?
A: We are in the process of implementing the loading PDF documents in a way that takes advantage of the linearization structure or property of a PDF document. But as of v2015R2, this is not supported yet in our PDF components.
There is however a class in Qoppa’s components API called URLOnDemandPDFSource that can be used to display the first page of the PDF (whether it is linearized or not) without having to load the whole PDF. The source creates a local copy of the PDF either in a byte array or a local temp file and downloads sections of the PDF only when they are accessed.
PDFNotesBean pdfNotes = new PDFNotesBean(); pdfNotes.loadPDF(new URLOnDemandPDFSource (new URL(urlString)));
Requirement: The HTTP server has to support the HTTP Range property.
Note that the improvement in performance (when using URLOnDemandPDFSource versus URLPDFSource) will depend widely on the structure of the PDF document, as well as the way the web server serves the PDF. One use case where you will see significant improvement is the following:
- The PDF documents is saved as a file on the web server (not served from a database).
- The PDF document is composed of large images.
- There are more than 10 pages.
- The thumbnail pane is not visible.
The best thing is to try on your specific documents inside your environment to determine if this source is going to work for you.