Q: Is there a way to save a PDF optimized for web reading in a way that the the 1st pages of a PDF can be displayed immediately to the user screen while the rest of the PDF continues loading?

A: You can use our PDF library jPDFProcess to save PDF documents as “linearized”. Linearized documents contain all the information to render the first page of a PDF document at the top of the file.

If the end-user is opening the document in a reader that makes use of the linearization structure (for instance Adobe Reader),  the reader will be able display the first page as soon as it downloads its data, and then continue to download the rest of the document in the background.

To save a PDF as linearized, instead of calling one of the saveDocument() methods, you will need to call the saveDocumentLinearized() method:

PDFDocument.saveDocumentLinearized (OutputStream outStream);

Read more information about PDF linearization.