Optimize a PDF file for a browser Leave feedbackOn this pageThis optimization allows a browser to display the first pages of a PDF file when you open the document, instead of waiting for the entire file to download.The following code snippet shows how to optimize a PDF file for browser: Javatry (Viewer viewer = new Viewer("sample.docx")) { PdfViewOptions viewOptions = new PdfViewOptions(); viewOptions.setPdfOptimizationOptions(new PdfOptimizationOptions()); viewOptions.getPdfOptimizationOptions().setLinearize(true); viewer.view(viewOptions); } Was this page helpful?Not really Yes, thanksAny additional feedback you'd like to share with us?Skip SendPlease tell us how we can improve this page.Skip SendThank you for your feedback!We value your opinion. Your feedback will help us improve our documentation.