public class PDFElectronicSealOperation extends Object implements Operation
To know more about PDF Electronic Seal, please see the documentation.
Sample Usage:
CertificateCredentials certificateCredentials = CertificateCredentials.cscCredentialBuilder()
.withProviderName("<PROVIDER_NAME>")
.withCredentialID("<CREDENTIAL_ID>")
.withPin("<PIN>")
.withCSCAuthContext(new CSCAuthContext("<ACCESS_TOKEN>"))
.build();
String sealFieldName = "Signature1";
FieldOptions fieldOptions = new FieldOptions.Builder(sealFieldName)
.setFieldLocation(new FieldLocation(150, 250, 350, 200))
.setPageNumber(1)
.build();
DocumentLevelPermission documentLevelPermission = DocumentLevelPermission.FORM_FILLING;
SealOptions sealOptions = new SealOptions.Builder(certificateCredentials, fieldOptions)
.withDocumentLevelPermission(documentLevelPermission)
.build();
PDFElectronicSealOperation pdfElectronicSealOperation = PDFElectronicSealOperation.createNew(sealOptions);
pdfElectronicSealOperation.setInput(FileRef.createFromLocalFile("~/Documents/SampleInvoice.pdf"));
Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
.withClientId("PDF_SERVICES_CLIENT_ID")
.withClientSecret("PDF_SERVICES_CLIENT_SECRET")
.build();
FileRef result = electronicSealOperation.execute(ExecutionContext.create(credentials));
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(SealOptions sealOptions)
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 |
setInput(FileRef inputDoc)
Sets the input PDF document.
|
void |
setSealImage(FileRef sealImage)
Sets the seal image file.
|
public void setInput(FileRef inputDoc)
inputDoc
- inputDoc an input PDF file; Cannot be nullpublic void setSealImage(FileRef sealImage)
sealImage
- a seal image file; Supported formats: JPEG, PNG, PDFpublic static PDFElectronicSealOperation createNew(SealOptions sealOptions)
PDFElectronicSealOperation
instance.sealOptions
- 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 © 2023 Adobe. All rights reserved.