public class LinearizePDFOperation extends Object implements Operation
Sample Usage:
LinearizePDFOperation linearizePDFOperation = LinearizePDFOperation.createNew();
linearizePDFOperation.setInput(FileRef.createFromLocalFile("~/Documents/linearizeOperationInput.pdf",
LinearizePDFOperation.SupportedSourceFormat.PDF.getMediaType()));
Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();
FileRef result = linearizePDFOperation.execute(ExecutionContext.create(credentials));
result.saveAs("output/linearizeOperationOutput.pdf");
Modifier and Type | Class and Description |
---|---|
static class |
LinearizePDFOperation.SupportedSourceFormat
Supported source file formats for
LinearizePDFOperation . |
Modifier and Type | Method and Description |
---|---|
static LinearizePDFOperation |
createNew()
Constructs a
LinearizePDFOperation 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 LinearizePDFOperation createNew()
LinearizePDFOperation
instance.LinearizePDFOperation
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 Operation
context
- 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.