Class ProtectPDFJob

  • public class ProtectPDFJob
    extends PDFServicesJob
    A job that is used for securing PDF document with password(s). The password(s) is used for encrypting the PDF document and setting the restriction on certain features like printing, editing and copying in the PDF document.

    The supported algorithm for encrypting the PDF document are listed here. The EncryptionAlgorithm enum can be used to set the encryption algorithm.

    • AES-128
    • AES-256

    For AES-128 encryption the password supports LATIN-I characters only. For AES-256 encryption the password supports Unicode character set.

    Sample Usage:

                 InputStream inputStream = new FileInputStream(new File("SOURCE_PATH"));
                 Credentials credentials = new ServicePrincipalCredentials(
                 PDFServices pdfServices = new PDFServices(credentials);
                 Permissions permissions = new Permissions();
                 ProtectPDFParams protectPDFParams = ProtectPDFParams.passwordProtectOptionsBuilder()
                ProtectPDFJob protectPDFJob = new ProtectPDFJob(asset, protectPDFParams);
                 String location = pdfServices.submit(protectPDFJob);
                 PDFServicesResponse<ProtectPDFResult> pdfServicesResponse = pdfServices.getJobResult(location, ProtectPDFResult.class);
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(resultAsset);
    • Constructor Detail

      • ProtectPDFJob

        public ProtectPDFJob​(Asset asset,
                             ProtectPDFParams protectPDFParams)
        Constructs a new ProtectPDFJob instance.
        asset - Asset object containing the input file; can not be null.
        protectPDFParams - ProtectPDFParams object containing the protect PDF parameters; can not be null.
    • Method Detail

      • setOutput

        public ProtectPDFJob 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
        asset - Asset object representing the output asset; can not be null.
        ProtectPDFJob instance