Class ProtectPDFJob
- java.lang.Object
-
- com.adobe.pdfservices.operation.PDFServicesJob
-
- com.adobe.pdfservices.operation.pdfjobs.jobs.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( System.getenv("PDF_SERVICES_CLIENT_ID"), System.getenv("PDF_SERVICES_CLIENT_SECRET")); PDFServices pdfServices = new PDFServices(credentials); Permissions permissions = new Permissions(); permissions.addPermission(Permission.PRINT_LOW_QUALITY); permissions.addPermission(Permission.EDIT_DOCUMENT_ASSEMBLY); permissions.addPermission(Permission.COPY_CONTENT); ProtectPDFParams protectPDFParams = ProtectPDFParams.passwordProtectOptionsBuilder() .setUserPassword("openpassword") .setOwnerPassword("permissionspassword") .setEncryptionAlgorithm(EncryptionAlgorithm.AES_128) .setContentEncryption(ContentEncryption.ALL_CONTENT_EXCEPT_METADATA) .setPermissions(permissions) .build(); 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 Summary
Constructors Constructor Description ProtectPDFJob(Asset asset, ProtectPDFParams protectPDFParams)
Constructs a newProtectPDFJob
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtectPDFJob
setOutput(Asset asset)
Sets the output asset for the job.
-
-
-
Constructor Detail
-
ProtectPDFJob
public ProtectPDFJob(Asset asset, ProtectPDFParams protectPDFParams)
Constructs a newProtectPDFJob
instance.- Parameters:
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- Parameters:
asset
-Asset
object representing the output asset; can not be null.- Returns:
ProtectPDFJob
instance
-
-