Class ProtectPDFJob
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 {@link 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.
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class ProtectPDFJob : PDFServicesJob
Examples
Sample Usage:
using Stream inputStream = File.OpenRead("<SOURCE_PATH>");
ICredentials credentials = new ServicePrincipalCredentials(
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_ID"),
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_SECRET"));
PDFServices pdfServices = new PDFServices(credentials);
IAsset asset = pdfServices.Upload(inputStream, PDFServicesMediaType.PDF.GetMIMETypeValue());
ProtectPDFParams protectPDFParams = ProtectPDFParams.PasswordProtectParamsBuilder()
.SetUserPassword("password")
.SetEncryptionAlgorithm(EncryptionAlgorithm.AES_256)
.Build();
ProtectPDFJob protectPDFJob = new ProtectPDFJob(asset, protectPDFParams);
String location = pdfServices.Submit(protectPDFJob);
PDFServicesResponse<ProtectPDFResult> pdfServicesResponse =
pdfServices.GetJobResult<ProtectPDFResult>(location, typeof(ProtectPDFResult));
IAsset resultAsset = pdfServicesResponse.Result.Asset;
StreamAsset streamAsset = pdfServices.GetContent(resultAsset);
Constructors
ProtectPDFJob(IAsset, ProtectPDFParams)
Constructs a new ProtectPDFJob
instance.
Declaration
public ProtectPDFJob(IAsset asset, ProtectPDFParams protectPDFParams)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The input IAsset for the job; can not be null. |
Protect |
protectPDFParams | The input Protect |
Methods
SetOutput(IAsset)
Sets the output asset for the job.
Declaration
public ProtectPDFJob SetOutput(IAsset asset)
Parameters
Returns
Type | Description |
---|---|
Protect |
|
Remarks
External assets can be set as output only when input is external asset as well