Encrypt a PDF with the standard PDF security handler,
40-bit or 128-bit encryption.
Encrypt can directly re-encrypt PDFs, substantially upgrading security
of older PDFs by strengthening encryption from 40 bits to 128 bits.
Furthermore, set restrictions on document use, such as preventing
high quality printing or copy and paste.
java tool.pdf.Encrypt [options] PDF-files-or-directories
In the absence of -inplace,
the encrypted version of the PDF is named with
- -password password --
directly re-encrypt a PDF by supplying the existing owner password
- -user password --
set user password.
In the absence of a user password,
the null password is used, which lets one set restrictions
without requiring a password to view the document.
- -owner password --
set owner password.
- -restrict[ions] actions --
- -perm[missions] actions --
-restrict and -perm
set the operations available on the encrypted document.
If -perm is given, then all actions
are restricted except those so permitted.
If -restrict is given, then all actions
are permitted except those so restricted.
If neither option is given, all operations are permitted.
Actions are expressed as one or more letters from the following list:
p - print high-quality
P - print
c - copy or otherwise extract text and graphics
C - copy or otherwise extract text even for disabled users
m - modify the contents, such as creating form fields and signatures
t - annotate
f - fill in forms
a - assemble the document (insert, rotate, delete pages, create bookmarks or thumbnail images)
all as a synonym for
- -compat[ible] --
rather than 128-bit encryption,
use only 40-bit encryption in order to be compatible with older PDF viewers
(Acrobat 5 and later support 128-bit encryption).
This is not recommended because 40-bit keys are easily cracked.
- -inplace -- write encrypted PDF over existing
-y appended to the original file name.
Encrypt with user password xxx and owner password yyy,
and allow printing but not copy and paste or other manipulation.
java tool.pdf.Encrypt -user xxx -owner yyy -perm pP Annotations.pdf