PDF - Encrypt

Declaration

<AMPDF ACTIVITY="encrypt" SOURCE="text" PASSWORD="encrypted 
text" SAVETYPE="text (options)" DESTINATION="text" 
OPENPASSWORD="encrypted text" ENCRYPT="text (options)" 
PERMISSION="YES/NO" PERMISSIONPASSWORD="text (options)" 
PRINT="text (options)" CHANGE="text" />

Description: Encrypts and password protects a PDF document to limit access and restrict certain features, such as printing or editing.

Practical Usage

Used to protect a PDF document and restrict the way people can use it. 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.

Resource Parameters

Property

Type

Required

Default

Markup

Description

Resource

---

---

---

---

Indicates where the source PDF should originate from. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:

  • File (default) - Specifies that the source PDF derives from a file located on the system. This option is normally chosen if only a single activity is required to complete an operation.

  • Session - Specifies that the source PDF is obtained from a pre-configured session created in an earlier step with the use of the PDF - Create session activity. This options is normally chosen if a combination of activities within the same action group are required. Linking several activities to a single session eliminates redundancy and improves efficiency. Several sessions can exist in a single task. In addition, multiple sessions can run simultaneously without interference.

Session

Text

Yes if Resource parameter is set to Session

PDFSession1

SESSION="mySession"

The name of an existing session to associate this activity with. This parameter is active only if the Resource parameter is set to Session.

Use

Text (options)

Yes if Resource parameter  is set to File

Existing PDF

  1. PDFDOCUMENTFROM="existing_file"

  2. PDFDOCUMENTFROM="new_file"

Specifies whether this activity will be performed on an existing PDF document or on a new document. This parameter is active only if the Resource parameter is set to File. The available options are:

  • Existing PDF (default) - This activity will be performed on an existing PDF document.

  • New PDF - This activity will be performed on a newly created PDF file.

Source PDF

Text

Yes if Use parameter is set to Existing PDF

(Empty)

SOURCE="C:\PDFFileName.pdf"

The path and filename of an existing PDF document to be used as the source. This parameter is active only if the Use parameter is set to Existing PDF.

Password (optional)

Text

Yes if Use parameter is set to Existing PDF

(Empty)

PASSWORD="encrypted"

The password required to open an existing PDF document (if required). This parameter is active only if the Use parameter is set to Existing PDF.

On completion

Text (options)

Yes if Use parameter is set to Existing PDF

Save

  1. SAVETYPE="save"

  2. SAVETYPE="do_not_save"

  3. SAVETYPE="save_as"

Specifies what action should be performed on the existing PDF file upon completion of this activity. This parameter is active only if the Use parameter is set to Existing PDF. The available options are:

  • Save (default) - Changes will be saved under the PDF document's original file name.

  • Do not save changes - Any changes this activity made to the existing PDF document will not be saved.

  • Save As - Changes will be saved to a new path and filename.

Destination PDF

Text

Yes if On Completion parameter is set to Save as

(Empty)

DESTINATION="C:\PDFFileName.pdf"

The new path and/or filename in which to save a copy of the original PDF file. This parameter is active only if the On completion parameter is set to Save as.

New PDF

Text

Yes if Use parameter is set to New PDF

(Empty)

NEWPDF="C:\PDFFileName.pdf"

The path and file name in which to output the newly generated PDF document. This parameter is active only if the Use parameter is set to New PDF.

Security Parameters

Property

Type

Required

Default

Markup

Description

Document open password

Text

Yes

(Empty)

OPENPASSWORD="encrypted"

The password later required to open the document.

Encryption level

Text (options)

No

256-bit AES

  1. ENCRYPT="AES_256"

  2. ENCRYPT="AES_128"

  3. ENCRYPT="RC4_128"

  4. ENCRYPT="RC4_40"

The encryption algorithm used 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:

  • 256-bit AES (default)

  • 128-bit AES

  • 128-bit RC4

  • 40-bit RC4

Permissions Parameters

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 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

(Empty)

PERMISSIONPASSWORD="encrypted"

The password that is required to change the permissions settings. If this parameter is empty, the user must enter the password entered in the Document open password parameter. This parameter is active only if the Restrict editing and printing of the document parameter is set to YES.

Printing allowed

Text (options)

No

None

  1. PRINT="none"

  2. PRINT="low_resolution"

  3. PRINT="high_resolution"

The type of printing allowed on the PDF document. The available options are:

  • None (default) - Prevents users from printing the document.

  • Low resolution (150 dpi) - Lets users print at no higher than 150dpi resolution. Printing may be slower because each page is printed as a bitmap image.

  • High resolution - Lets users print at any resolution, directing high-quality vector output to PostScript and other printers that support advanced high-quality printing features.

Changes allowed

Text (options)

No

None

  1. CHANGE="none"

  2. CHANGE="insert_delete_rotate"

  3. CHANGE="form"

  4. CHANGE="comment"

Defines which editing actions are allowed in the PDF document. The available options are:

  • None (default) - Prevents users from making any changes to the document, such as filling in form fields and adding comments.

  • Inserting, deleting and rotating pages - Grants users permission to insert, delete, and rotate pages.

  • Commenting, filling in form fields and signing existing signature fields - Grants users permission to fill in fields in interactive forms and add digital signatures to existing signature fields.

  • Any Except Extracting Pages - Grants permissions to edit the document, create and fill in form fields, and add comments and digital signatures.

Enable copying of text, images and other content

Text

No

disabled

COPY="copy"

If enabled, users are granted permission to copy text, images and other content.

Enable text access for screen reader devices for the visually impaired

Text

No

disabled

CHANGE="form"

If enabled, 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. This option is available only for high (128bit RC4 o AES) encryption.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Encrypt PDF with Password. Encryption level is "AES128". Print allowed "High". Change allowed "Extract". Existing PDF "C:\temp\myDocument.pdf". Save PDF As "C:\temp\myNewDocument.pdf".

<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" />