Decrypt

This command decrypts inFile and removes password protection. If provided the decrypted PDF will be written to outFile and ìnFile remains untouched. Have a look at some examples.

Usage

  1. usage: pdfcpu decrypt [-v(erbose)|vv] [-upw userpw] [-opw ownerpw] inFile [outFile]

Flags

namedescriptionrequired
verboseturn on loggingno
vvverbose loggingno
upwuser passwordno
opwowner passwordno

Arguments

namedescriptionrequired
inFileencrypted PDF input fileyes
outFilePDF output fileno

Matrix

The following matrix is a result of the intrinsics of how PDF encryption works:

encrypted usingneeded for decryptionuse case
opw-reset permissions
upwupwremove open doc password & reset permissions
opw and upwopw or upwremove open doc password & reset permissions

Examples

Decrypt a file that has only the owner password set. This will also reset all permissions, providing full access. You don’t need to provide any password:

  1. pdfcpu encrypt -opw opw test.pdf
  2. writing test.pdf ...
  3. pdfcpu decrypt test.pdf
  4. writing test.pdf ...

Decrypt a file that has only the user password set. This will remove the open doc password and also reset all permissions, providing full access. You need to provide the user password:

  1. pdfcpu encrypt -upw upw test.pdf
  2. writing test.pdf ...
  3. pdfcpu decrypt test.pdf
  4. Please provide the correct password
  5. pdfcpu decrypt -upw upw test.pdf
  6. writing test.pdf ...

Decrypt a file that is protected by both the user password and the owner password. This also removes the open doc password and resets all permissions providing full access. You will need to provide either of the two passwords:

  1. pdfcpu encrypt -opw opw -upw upw test.pdf
  2. writing test.pdf ...
  3. pdfcpu decrypt test.pdf
  4. Please provide the correct password
  5. pdfcpu decrypt -upw upw test.pdf
  6. writing test.pdf ...
  1. pdfcpu encrypt -opw opw -upw upw test.pdf
  2. writing test.pdf ...
  3. pdfcpu decrypt test.pdf
  4. Please provide the correct password
  5. pdfcpu decrypt -opw opw test.pdf
  6. writing test.pdf ...