Edit in GitHubLog an issue

Linearize PDFs

Optimize PDFs for quick viewing on the web, especially for mobile clients. Linearization allows your end users to view large PDF documents incrementally so that they can view pages much faster in lower bandwidth conditions.

Rest API

See our public API Reference for Linearize PDF

Linearize PDF

Linearizing a PDF creates a web-optimized PDF file which supports incremental access in network environments.

Please refer the API usage guide to understand how to use our APIs.

Copied to your clipboard
// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples
// Run the sample:
// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.linearizepdf.LinearizePDF
public class LinearizePDF {
// Initialize the logger.
private static final Logger LOGGER = LoggerFactory.getLogger(LinearizePDF.class);
public static void main(String[] args) {
try {
// Initial setup, create credentials instance.
Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
.withClientId("PDF_SERVICES_CLIENT_ID")
.withClientSecret("PDF_SERVICES_CLIENT_SECRET")
.build();
// Create an ExecutionContext using credentials and create a new operation instance.
ExecutionContext executionContext = ExecutionContext.create(credentials);
LinearizePDFOperation linearizePDFOperation = LinearizePDFOperation.createNew();
// Set operation input from a source file.
FileRef source = FileRef.createFromLocalFile("src/main/resources/linearizePDFInput.pdf");
linearizePDFOperation.setInput(source);
// Execute the operation
FileRef result = linearizePDFOperation.execute(executionContext);
// Save the result at the specified location
result.saveAs("output/linearizePDFOutput.pdf");
} catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {
LOGGER.error("Exception encountered while executing operation", ex);
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.