Class CompressPDFJob
- java.lang.Object
-
- com.adobe.pdfservices.operation.PDFServicesJob
-
- com.adobe.pdfservices.operation.pdfjobs.jobs.CompressPDFJob
-
public class CompressPDFJob extends PDFServicesJob
A job that reduces the size of a PDF file. Allows specifying compressionLevel(CompressionLevel) for compressing pdfSample Usage:
InputStream inputStream = new FileInputStream(new File("SOURCE_PATH")); Credentials credentials = new ServicePrincipalCredentials( System.getenv("PDF_SERVICES_CLIENT_ID"), System.getenv("PDF_SERVICES_CLIENT_SECRET")); PDFServices pdfServices = new PDFServices(credentials); Asset asset = pdfServices.upload(inputStream, PDFServicesMediaType.PDF.getMediaType()); CompressPDFJob compressPDFJob = new CompressPDFJob(asset); String location = pdfServices.submit(compressPDFJob); PDFServicesResponse<CompressPDFResult> pdfServicesResponse = pdfServices.getJobResult(location, CompressPDFResult.class); Asset compressedPDFAsset = pdfServicesResponse.getResult().getAsset(); StreamAsset compressedPDFStreamAsset = pdfServices.getContent(compressedPDFAsset);
-
-
Constructor Summary
Constructors Constructor Description CompressPDFJob(Asset asset)Constructs a newCompressPDFJobinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompressPDFJobsetOutput(Asset asset)Sets the output asset for the job.CompressPDFJobsetParams(CompressPDFParams compressPDFParams)Sets the compression level for the input PDF file.
-
-
-
Method Detail
-
setParams
public CompressPDFJob setParams(CompressPDFParams compressPDFParams)
Sets the compression level for the input PDF file.- Parameters:
compressPDFParams-CompressPDFParamsobject containing the compression level; can not be null.- Returns:
CompressPDFJobinstance
-
setOutput
public CompressPDFJob setOutput(Asset asset)
Sets the output asset for the job.@noteExternal assets can be set as output only when input is external asset as well- Parameters:
asset-Assetobject representing the output asset; can not be null.- Returns:
CompressPDFJobinstance
-
-