Class PDFElectronicSealJob


  • public class PDFElectronicSealJob
    extends PDFServicesJob
    A job 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:

     
                 InputStream inputStream = new FileInputStream(new File("SOURCE_PATH"));
    
                 Credentials credentials = new ServicePrincipalCredentials(
                         System.getenv("PDF_SERVICES_CLIENT_ID"),
                         System.getenv("PDF_SERVICES_CLIENT_SECRET"));
    
                 PDFServices pdfServices = new PDFServices(credentials);
    
                 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();
    
                 PDFElectronicSealParams pdfElectronicSealParams = PDFElectronicSealParams.pdfElectronicSealParamsBuilder(certificateCredentials, fieldOptions).build();
    
                 PDFElectronicSealJob pdfElectronicSealJob = new PDFElectronicSealJob(asset, pdfElectronicSealParams);
    
                 String location = pdfServices.submit(pdfElectronicSealJob);
                 PDFServicesResponse<PDFElectronicSealResult> pdfServicesResponse = pdfServices.getJobResult(location, PDFElectronicSealResult.class);
    
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(esealResult);
     
     
    • Constructor Detail

      • PDFElectronicSealJob

        public PDFElectronicSealJob​(Asset inputDocumentAsset,
                                    PDFElectronicSealParams pdfElectronicSealParams)
        Constructs a new PDFElectronicSealJob instance.
        Parameters:
        inputDocumentAsset - Asset object containing the input file; can not be null.
        pdfElectronicSealParams - PDFElectronicSealParams object containing the parameters for electronic seal; can not be null.
    • Method Detail

      • setSealImageAsset

        public void setSealImageAsset​(Asset sealImageAsset)
        Sets the seal image asset for the job.
        Parameters:
        sealImageAsset - Asset object representing the seal image asset; can not be null.
      • setOutput

        public PDFElectronicSealJob setOutput​(Asset asset)
        Sets the output asset for the job. @note External assets can be set as output only when input is external asset as well
        Parameters:
        asset - Asset object representing the output asset; can not be null.
        Returns:
        PDFElectronicSealJob instance