Run Apache PDFBox in a docker container to manipulate PDF files.
Encrypt file
docker run -it -v $PWD:/home crochik/pdfbox Encrypt -U <password> -keyLength 256 <input> <output>
Decrypt file
docker run -it -v $PWD:/home crochik/pdfbox Decrypt -password <password> <input> <output>
Notes:
- In the commands above, $PWD is used to mount the current folder as the working folder for the container so you can access files on it. The current folder must be shared in docker so the container can have access to it.
- $PWD works on MacOS. On other OS it may be different (e.g. ${pwd})
- You can replace $PWD with he absolute path of the folder where the pdf files are (again, just make it is shared in docker).
- -keyLength 256, will encrypt the PDF using AES 256.
0 Comments