public class PDFPropertiesOperation extends Object implements Operation
Sample Usage:
PDFPropertiesOperation pdfPropertiesOperation = PDFPropertiesOperation.createNew();
FileRef source = FileRef.createFromLocalFile("src/test/resources/pdfPropertiesOperationInput.pdf");
pdfPropertiesOperation.setInputFile(source);
Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
.withClientId("PDF_SERVICES_CLIENT_ID")
.withClientSecret("PDF_SERVICES_CLIENT_SECRET")
.build();
PDFProperties result = pdfPropertiesOperation.execute(ExecutionContext.create(credentials));
String filesize = result.getDocument().getFileSize();
Modifier and Type | Method and Description |
---|---|
static PDFPropertiesOperation |
createNew()
Constructs a
PDFPropertiesOperation instance. |
PDFProperties |
execute(ExecutionContext context)
Executes this operation synchronously using the supplied context and returns a new JSONObject instance for the resulting JSON object.
|
void |
setInputFile(FileRef sourceFileRef)
Sets an input file.
|
void |
setOptions(PDFPropertiesOptions pdfPropertiesOptions)
Sets the options for this operation.
|
public void setOptions(PDFPropertiesOptions pdfPropertiesOptions)
PDFPropertiesOptions
for how to specify the
options for PDF Properties Operation.pdfPropertiesOptions
- optional parameters; use null for default valuespublic static PDFPropertiesOperation createNew()
PDFPropertiesOperation
instance.PDFPropertiesOperation
instancepublic void setInputFile(FileRef sourceFileRef)
sourceFileRef
- an input filepublic PDFProperties execute(ExecutionContext context) throws ServiceApiException, IOException, ServiceUsageException
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 JSON ObjectServiceUsageException
- if service usage limits have been reached or credentials quota has been exhausted.Copyright © 2023 Adobe. All rights reserved.