PDF - Encrypt
Declaration
<AMPDF ACTIVITY="encrypt" SESSION="text" SOURCE="text" PASSWORD="encrypted text" SAVETYPE="text (options)" DESTINATION="text" PDFDOCUMENTFROM="text (options)" NEWPDF="text" OVERWRITE="YES/NO" CREATEEMPTY="YES/NO" OPENPASSWORD="text (encrypted)" ENCRYPT="text (options)" PERMISSION="YES/NO" PERMISSIONPASSWORD="text (options)" PRINT="text (options)" CHANGE="text" COPY="text (options)/>
Description
Encrypts and password protects a PDF file to limit access and restrict certain features, such as printing or editing.
Practical usage
Used to protect a PDF file and restrict the way it is used. For example, you can prevent others from editing and copying information, or fine-tune file permissions to limit other activities like printing, commenting, form filling, and adding pages.
Parameters
Resource
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Resource | --- | --- | --- | --- | Specifies the source of the PDF file. The available options are:
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Session | Text | Yes, if Resource is set to Session | PDFSession1 | SESSION="mySession" | The existing session to associate with this activity. This parameter becomes active and is required if the Resource parameter is set to Session. |
Use | Text (options) | Yes, if Resource is set to File | Existing PDF |
|
Specifies
whether to add attachments to an existing or newly-created PDF file. This parameter becomes active and is required if the
Resource parameter is
set to File. The available options are:
|
Source PDF | Text | Yes, if Use is set to Existing PDF | (Empty) | SOURCE="C:\PDFFileName.pdf" | The path and file name of PDF to encrypt. This parameter becomes active and is required if the Use parameter is set to Existing PDF. |
Password (optional) | Text | No | (Empty) | PASSWORD="encrypted" | The password required to open the existing PDF file (if required). This parameter becomes active if the Use parameter is set to Existing PDF. |
On completion | Text (options) | Yes, if Use is set to Existing PDF | Save |
|
Specifies how changes to the PDF file are saved upon completion of this activity. This parameter becomes active and is required if the Use parameter is set
to Existing PDF. The available
options are:
|
Destination PDF | Text | Yes, if On completion is set to Save as | (Empty) | DESTINATION="C:\PDFFileName.pdf" | The path and file name where the modified existing PDF file is stored. This parameter becomes active and is required if the On completion parameter is set to Save as. |
New PDF | Text | Yes, if Use is set to New PDF | (Empty) | NEWPDF="C:\PDFFileName.pdf" | The path and file name where the newly-generated PDF file is stored. This parameter becomes active and is required if the Use parameter is set to New PDF. |
Overwrite if PDF already exists | Yes/No | No | No | OVERWRITE="YES" | If selected, a PDF file with the same filename in the destination folder is overwritten when this activity runs. If disabled (default), a PDF file with the same filename in the destination folder is not overwritten, however, a runtime error occurs as a result. |
Create empty PDF file | Yes/No | No | No | CREATEEMPTY="YES" | If selected, the activity creates an empty, single-page PDF file. This parameter becomes active if the Use parameter is set to New PDF. |
Security
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Document open password | Text | Yes | (Empty) | OPENPASSWORD="encrypted text" | The password required to open the document. |
Encryption level | Text (options) | No | 256-bit AES |
|
Specifies the encryption algorithm
to use to encrypt the document. PDF
encryption makes use of two algorithms; RC4, a symmetric stream
cipher, and AES (Advanced Encryption Standard), a more modern block
cipher. The available options are:
|
Permissions
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Restrict editing and printing of the document | Yes/No | No | No | PERMISSION="YES" | If set to YES (enabled), restrictions will be applied to the editing and printing of the document. Also restricts access to the PDF file’s security settings. If the file is opened in Adobe Acrobat, the user can view the file but must enter the specified Permissions password in order to change the file’s Security and Permissions settings. If the file is opened in Illustrator, Photoshop, or InDesign, the user must enter the Permissions password, since it is not possible to open the file in a view only mode. If set NO (disabled), no restrictions are applied to the editing and printing of the document. This parameter is set to NO (disabled) by default. |
Change permission password | Text | Yes, if Restrict editing and printing of the document is set to YES | (Empty) | PERMISSIONPASSWORD="encrypted" | The password required to change the permission settings. If this parameter is empty, the user must enter the password entered in the Document open password parameter. This parameter becomes active and is required if the Restrict editing and printing of the document parameter is set to YES. |
Printing allowed | Text (options) | No | None |
|
Specifies the type of printing allowed
for the PDF file. The available options are:
|
Changes allowed | Text (options) | No | None |
|
Specifies which editing actions
are allowed in the PDF file. The available options are:
|
Enable copying of text, images and other content | Text | No | Not selected | COPY="copy" | If selected, users are granted permission to copy text, images, and other content. |
Enable text access for screen reader devices for the visually impaired | Text | No | Selected | CHANGE="form" | If selected, grants visually impaired users permission to read the document with screen readers, but doesn’t allow users to copy or extract the document’s contents. |
Example
NOTE:
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task encrypts a PDF file and then saves it using a different file name.
Copy
<AMPDF ACTIVITY="encrypt" SOURCE="C:\Temp\MyDocument.pdf" SAVETYPE="save_as" DESTINATION="C:\Temp\MyNewDocument.pdf" OPENPASSWORD="AM2X8RGOSnCwfUrxCM5UcK19Q==aME" ENCRYPT="AES_128" PERMISSION="YES" PERMISSIONPASSWORD="AM2X8RGOSnCwfUrxCM5UcK19Q==aME" PRINT="high_resolution" CHANGE="extract" />