Class RemoveProtectionJob


  • public class RemoveProtectionJob
    extends PDFServicesJob
    A job that allows to remove password security from a PDF document.

    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);
    
                 Asset asset = pdfServices.upload(inputStream, PDFServicesMediaType.PDF.getMediaType());
    
                 RemoveProtectionParams removeProtectionParams = new RemoveProtectionParams("mypassword");
                 RemoveProtectionJob removeProtectionJob = new RemoveProtectionJob(asset, removeProtectionParams);
    
                 String location = pdfServices.submit(removeProtectionJob);
                 PDFServicesResponse<RemoveProtectionResult> pdfServicesResponse = pdfServices.getJobResult(location, RemoveProtectionResult.class);
    
                 Asset resultAsset = pdfServicesResponse.getResult().getAsset();
                 StreamAsset streamAsset = pdfServices.getContent(resultAsset);
     
    • Constructor Detail

      • RemoveProtectionJob

        public RemoveProtectionJob​(Asset asset,
                                   RemoveProtectionParams removeProtectionParams)
        Constructs a new RemoveProtectionJob instance.
        Parameters:
        asset - Asset object containing the input file; can not be null.
        removeProtectionParams - RemoveProtectionParams object containing the password for removing protection; can not be null.
    • Method Detail

      • setOutput

        public RemoveProtectionJob 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:
        RemoveProtectionJob instance