public class PDFElectronicSealOperation extends Object implements Operation
To know more about PDF Electronic Seal, please see the documentation.
Sample Usage:
SealFieldOptions sealFieldOptions = new SealFieldOptions.Builder("sealField")
.setVisible(true)
.setSealFieldLocationOptions(new SealFieldLocationOptions(150, 250, 350, 200))
.setPageNumber(1)
.build();
SealCredentialOptions sealCredentialOptions = new CSCCredentialOptions.Builder("PROVIDER_NAME", "CREDENTIAL_ID",
"CREDENTIAL_PIN", "ACCESS_TOKEN").setTokenType("Bearer").build();
SealOptions sealOptions = new SealOptions.Builder(SignatureFormat.PKCS7, sealCredentialOptions,
sealFieldOptions).build();
PDFElectronicSealOptions electronicSealOptions = new PDFElectronicSealOptions(sealOptions);
PDFElectronicSealOperation electronicSealOperation = PDFElectronicSealOperation.createNew(electronicSealOptions);
electronicSealOperation.setInputDocument(FileRef.createFromLocalFile("~/Documents/SampleInvoice.pdf"));
FileRef result = electronicSealOperation.execute(executionContext);
result.saveAs("output/sealedOutput.pdf");
Modifier and Type | Class and Description |
---|---|
static class |
PDFElectronicSealOperation.SupportedSourceFormat
Supported source file formats for
PDFElectronicSealOperation . |
Modifier and Type | Method and Description |
---|---|
static PDFElectronicSealOperation |
createNew(PDFElectronicSealOptions electronicSealOptions)
Constructs a
PDFElectronicSealOperation instance. |
FileRef |
execute(ExecutionContext context)
Executes this operation synchronously using the supplied context and returns a new FileRef instance for the resulting sealed file.
|
void |
setInputDocument(FileRef inputDoc)
Sets the input PDF document.
|
void |
setSealImage(FileRef sealImage)
Sets the seal image file.
|
public void setInputDocument(FileRef inputDoc)
inputDoc
- an input file; Cannot be nullpublic void setSealImage(FileRef sealImage)
sealImage
- a seal image filepublic static PDFElectronicSealOperation createNew(PDFElectronicSealOptions electronicSealOptions)
PDFElectronicSealOperation
instance.electronicSealOptions
- options for applying electronic seal on the input PDF document; Cannot be nullPDFElectronicSealOperation
instancepublic 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 © 2022 Adobe. All rights reserved.