Skip to content

Decrypt PDF (remove password)

Description

The Decrypt PDF (remove password) activity processes input PDF files and removes password protection when a configured password rule matches the file name. It preserves files that are already unprotected, reports errors for corrupt PDFs, and reports password errors when the configured password is incorrect.

Supported Features

  • Multiple file processing: Processes each input file independently.
  • Regex-based password rules: Match files using FilePattern and apply the corresponding password.
  • Encrypted PDF detection: Detects whether a PDF is encrypted before attempting decryption.
  • Unprotected PDF passthrough: Unencrypted PDFs are skipped and returned unchanged.
  • Error collection: Collects errors for invalid PDFs, missing rules, incorrect passwords, and processing failures.

Input

TypeRequiredDescription
FilesYesPDF files to decrypt.

Input Scenarios

1. Encrypted PDF With Matching Rule

{
"Files": [
{ "FileName": "bank-statement-jan.pdf", "FullPath": "C:/Work/bank-statement-jan.pdf" }
]
}

2. Unencrypted PDF

The file is returned unchanged and an informational message is logged.

{
"Files": [
{ "FileName": "public-report.pdf", "FullPath": "C:/Work/public-report.pdf" }
]
}

3. Encrypted PDF With No Matching Rule

The activity records an error: No password rule matched for: <file>.


Output

FieldTypeDescription
FilesArrayDecrypted PDF files or unchanged input files for PDFs that were not password protected.
ErrorsArrayErrors for files that could not be decrypted or validated.

Output Behavior

  • If at least one file succeeds and some files fail, the activity returns success with errors.
  • If all files fail, the activity returns failure.
  • Decrypted files are written to the workflow base working folder using the original file name.

Example Output

{
"Files": [
{
"FileName": "bank-statement-jan.pdf",
"FullPath": "C:/Workflow/bank-statement-jan.pdf",
"Size": 45821
}
],
"Errors": []
}

Configuration Fields

Field NameTypeRequiredDescription
Password rulesObject ArrayYesList of filename matching rules. Each rule contains FilePattern and Password. The first matching rule is used.
FilePatternTextYesRegex pattern matched against the input file name. Matching is case-insensitive.
PasswordTextYesPassword used to open and decrypt files that match FilePattern.

Conditional Field Rendering Rules

No conditional configuration fields are defined for this activity.


Sample Configuration

FilePatternPassword
^bank-statement-.*\.pdf$Bank@2026
^invoice-.*\.pdf$Invoice@2026

Sample Output

{
"Files": [
{
"FileName": "bank-statement-jan.pdf",
"FullPath": "C:/Workflow/bank-statement-jan.pdf",
"Size": 45821
}
],
"Errors": [
"Incorrect password for: invoice-001.pdf"
]
}