PDFreactor can protect generated PDF documents via 40 or 128 bit encryption.
To encrypt the output PDF, set the encryption strength to a value other than "ENCRYPTION_NONE":
pdfReactor.setEncryption(PDFreactor.ENCRYPTION_128);
When the PDF document is opened, the user has to supply the user password in order to view the content. When no user password is set, the PDF can be viewed by any user. In either case, certain restrictions are imposed. These can be suspended by supplying the owner password. You can set the passwords as follows:
pdfReactor.setUserPassword("upasswd");
pdfReactor.setOwnerPassword("opasswd");Both passwords are optional, but recommended for security reasons.
By default all restrictions are imposed on the PDF document. You can however exclude selected ones by using the following methods:
Table IV.2. List of methods to disable restrictions
| Method name | Allows ... |
|---|---|
setAllowPrinting | printing |
setAllowCopy | copying or otherwise extracting content |
setAllowAnnotations | adding or modifying annotations and interactive form fields |
setAllowModifyContents | modifying the content of the document |
setAllowDegradedPrinting | printing (same as setAllowPrinting, however with a limited resolution) (128 bit encryption only) |
setAllowFillIn | filling in form fields (128 bit encryption only) |
setAllowAssembly | inserting, removing and rotating pages and adding bookmarks (128 bit encryption only) |
setAllowScreenReaders | extracting content for use by accessability devices (128 bit encryption only) |
API docs for further information.