com.adobe.pdfservices.operation.pdfjobs.params.compresspdf.CompressPDFParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pdfservices-sdk Show documentation
Show all versions of pdfservices-sdk Show documentation
Adobe PDF Services SDK allows you to access RESTful APIs to create, convert, and manipulate PDFs within your applications.
Older versions can be found under groupId: com.adobe.documentservices, artifactId: pdftools-sdk
/*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
package com.adobe.pdfservices.operation.pdfjobs.params.compresspdf;
import com.adobe.pdfservices.operation.internal.constants.CustomErrorMessages;
import com.adobe.pdfservices.operation.internal.util.ObjectUtil;
import com.adobe.pdfservices.operation.pdfjobs.jobs.CompressPDFJob;
import com.adobe.pdfservices.operation.pdfjobs.params.PDFServicesJobParams;
/**
* Parameters for reducing file size of a pdf using {@link CompressPDFJob}.
*/
public class CompressPDFParams implements PDFServicesJobParams {
private CompressionLevel compressionLevel;
private CompressPDFParams(Builder builder) {
this.compressionLevel = builder.compressionLevel;
}
/**
* Returns the compression level to be used for Compress PDF, specified by {@link CompressionLevel}.
*
* @return the compression level to be used for Compress PDF
*/
public String getCompressionLevel() {
return compressionLevel != null ? compressionLevel.toString() : null;
}
/**
* Creates a new {@link Builder}.
*
* @return a {@link Builder} instance
*/
public static Builder compressPDFParamsBuilder() {
return new Builder();
}
/**
* Builds a {@link CompressPDFParams} instance.
*/
public static class Builder {
private CompressionLevel compressionLevel;
/**
* Constructs a {@code CompressPDFParams.Builder} instance.
*/
public Builder() {
}
/**
* Sets compression level to be used for Compress PDF, specified by {@link CompressionLevel}.
*
* @param compressionLevel see {@link CompressionLevel}; can not be null.
* @return this Builder instance to add any additional parameters
*/
public Builder withCompressionLevel(CompressionLevel compressionLevel) {
ObjectUtil.requireNonNull(compressionLevel, String.format(CustomErrorMessages.GENERIC_CAN_NOT_BE_NULL,
"CompressionLevel"));
this.compressionLevel = compressionLevel;
return this;
}
/**
* Returns a new {@link CompressPDFParams} instance built from the current state of this builder.
*
* @return a new {@code CompressPDFParams} instance
*/
public CompressPDFParams build() {
return new CompressPDFParams(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy