PDFElectronicSealOperation

PDFElectronicSealOperation

An operation that allows clients to apply an electronic seal onto various PDF documents such as agreements, invoices and more.

To know more about PDF Electronic Seal, please see the documentation.

Sample Usage:


 const pdfElectronicSeal = PDFServicesSdk.PDFElectronicSeal,
 	options = pdfElectronicSeal.options;

 const certificateCredentials = options.CertificateCredentials.cscCredentialBuilder()
 	.withProviderName("<PROVIDER_NAME>")
 	.withCredentialID("<CREDENTIAL_ID>")
 	.withPin("<PIN>")
 	.withCSCAuthContext(new options.CSCAuthContext("<ACCESS_TOKEN>"))
 	.build();

 const sealFieldName = "Signature1";
 const fieldOptions = new options.FieldOptions.Builder(sealFieldName)
 	.setFieldLocation(new options.FieldLocation(150, 250, 350, 200))
 	.setPageNumber(1)
 	.build();

 const sealOptions = new options.SealOptions.Builder(certificateCredentials, fieldOptions).build(),
 	pdfElectronicSealOperation = pdfElectronicSeal.Operation.createNew(sealOptions);

 pdfElectronicSealOperation.setInput(PDFServicesSdk.FileRef.createFromLocalFile('~/Documents/sampleInvoice.pdf'));
 const credentials =  PDFServicesSdk.Credentials.servicePrincipalCredentialsBuilder()
        .withClientId("PDF_SERVICES_CLIENT_ID")
        .withClientSecret("PDF_SERVICES_CLIENT_SECRET")
        .build();
 pdfElectronicSealOperation.execute(PDFServicesSdk.ExecutionContext.create(credentials))
 	.then(result => result.saveAsFile('output/sealedOutput.pdf'));

Members

(static, constant) SupportedSourceFormat

Description:
Properties:
Name Type Description
pdf string

Represents "application/pdf" media type.

Supported source file formats for PDFElectronicSealOperation.

(static, constant) SupportedSealImageFormat

Description:
Properties:
Name Type Description
pdf string

Represents "application/pdf" media type.

jpeg string

Represents "image/jpeg" media type

png string

Represents "image/png" media type

Supported seal image media types for PDFElectronicSealOperation.

Methods

setInput(inputDocnon-null)

Description:
  • Sets the input PDF document.

Parameters:
Name Type Description
inputDoc FileRef

an input file; Cannot be null

setSealImage(sealImage)

Description:
  • Sets the seal image file.

Parameters:
Name Type Description
sealImage FileRef

a seal image file

(static) createNew(sealOptionsnon-null) → {PDFElectronicSealOperation}

Description:
Parameters:
Name Type Description
sealOptions SealOptions

options for applying electronic seal on the input PDF document; Cannot be null.

Returns:

a new PDFElectronicSealOperation instance

Type
PDFElectronicSealOperation

execute(contextnon-null) → {Promise.<FileRef>}

Description:
  • Executes this operation synchronously using the supplied context and returns a new FileRef instance for the resulting sealed file.

    The resulting file may be stored in the system temporary directory (per the os.tempdir(), symlinks are resolved to the actual path). See FileRef for how temporary resources are cleaned up.

Parameters:
Name Type Description
context ExecutionContext

the context in which to execute the operation.

Throws:
  • if an API call results in an error response.

    Type
    ServiceApiError
  • If service usage limits have been reached or credentials quota has been exhausted.

    Type
    ServiceUsageError
Returns:

A promise which resolves to the operation result.

Type
Promise.<FileRef>