public class CompressPDFOperation extends Object implements Operation
Sample Usage:
   CompressPDFOperation compressPDFOperation = CompressPDFOperation.createNew();
   compressPDFOperation.setInput(FileRef.createFromLocalFile("~/Documents/compressOperationInput.pdf",
                                                              CompressPDFOperation.SupportedSourceFormat.PDF.getMediaType()));
   Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();
   FileRef result = compressPDFOperation.execute(ExecutionContext.create(credentials));
   result.saveAs("output/compressOperationOutput.pdf");
 | Modifier and Type | Class and Description | 
|---|---|
static class  | 
CompressPDFOperation.SupportedSourceFormat
Supported source file formats for  
CompressPDFOperation. | 
| Modifier and Type | Method and Description | 
|---|---|
static CompressPDFOperation | 
createNew()
Constructs a  
CompressPDFOperation instance. | 
FileRef | 
execute(ExecutionContext context)
Executes this operation synchronously using the supplied context and returns a new FileRef instance for the resulting PDF file. 
 | 
void | 
setInput(FileRef sourceFileRef)
Sets an input file. 
 | 
public static CompressPDFOperation createNew()
CompressPDFOperation instance.CompressPDFOperation instancepublic void setInput(FileRef sourceFileRef)
sourceFileRef - an input filepublic FileRef execute(ExecutionContext context) throws ServiceApiException, IOException, ServiceUsageException
 The resulting file may be stored in the system temporary directory (per java.io.tmpdir System property).
 See FileRef for how temporary resources are cleaned up.
execute in interface Operationcontext - the context in which to execute the operationServiceApiException - if an API call results in an error responseIOException - if there is an error in reading either the input source or the resulting PDF fileServiceUsageException - if service usage limits have been reached or credentials quota has been exhaustedCopyright © 2020 Adobe. All rights reserved.