pdfcpu

Logo

PDF tooling for Go and the command line.

View the Project on GitHub pdfcpu/pdfcpu


Changelog
Future Directions

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

pdfcpu decrypt inFile [ outFile ] [flags]

Flags

namedescriptionrequired
upwuser passwordno
opwowner passwordno

Common Flags


Arguments

namedescriptionrequired
inFilePDF input file, use - to read from stdinyes
outFilePDF output file, use - to write to stdoutno

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:

$ pdfcpu encrypt test.pdf --opw opw
writing test.pdf ...

$ pdfcpu decrypt test.pdf 
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:

$ pdfcpu encrypt test.pdf --opw opw --upw upw
writing test.pdf ...

$ pdfcpu decrypt test.pdf
Please provide the correct password

$ pdfcpu decrypt test.pdf --upw upw 
writing test.pdf ...

Decrypt a streamed PDF and upload the result:

$ aws s3 cp s3://acme-hr/secure/onboarding.pdf - \
   | pdfcpu decrypt --upw "$UPW" - - \
   | aws s3 cp - s3://acme-hr/plain/onboarding.pdf