Hi Team,
Linearization of pdf is critical requirement for us and am seeing Aspose.PDF for Java does not provide a direct API method to linearize (enable Fast Web View) a PDF during save. will this feature will be added in the future.
Summary
Aspose.PDF for Java can produce a linearized (Fast Web View) PDF by enabling the Linearize flag on PdfSaveOptions before saving the document.
Why it happens
Earlier releases of Aspose.PDF for Java did not expose a linearization option, so the feature was unavailable. In recent versions (starting around 22.9) the PdfSaveOptions class includes the setLinearize(boolean) method. When this flag is set to true, the library arranges the PDF objects so that a viewer can begin rendering the first page before the entire file is downloaded.
What to do next
- Confirm your SDK version – Verify that you are using a version that includes
setLinearize(e.g., 22.9 or later). You can check the version at runtime:
System.out.println(com.aspose.pdf.Version.getVersion());
-
Upgrade if necessary – If the version is older, update the Maven/Gradle dependency to the latest Aspose.PDF for Java release and rebuild your project.
-
Enable linearization when saving – Apply the option as shown below:
import com.aspose.pdf.*;
public class LinearizePdf {
public static void main(String[] args) throws Exception {
// Load the source PDF
PdfDocument pdf = new PdfDocument("input.pdf");
// Configure save options
PdfSaveOptions saveOpts = new PdfSaveOptions();
saveOpts.setLinearize(true); // Enable Fast Web View
// Save the linearized PDF
pdf.save("output_linearized.pdf", saveOpts);
}
}
-
Validate the result – Open the saved file in a web browser or use a PDF inspection tool to confirm that the document is reported as “Linearized” or “Fast Web View”.
-
If the flag is still unavailable – Ensure the project is referencing the updated library JARs and that there are no older copies on the classpath. If the issue persists after confirming the version, please provide the exact SDK version you are using so we can investigate further internally.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.