Generator > Programming > Security

DynamicPDF™ Generator for Java supports 40 and 128 bit encryption. Documents can be locked with a User and Owner password. Document permissions can be set to limit a user's access to the document. 40 bit encryption is compatible with PDF 1.1 or greater. 128 bit encryption is compatible with PDF 1.4 or greater and requires Acrobat 5.0 or greater or a compatible viewer.

Encryption is handled by two security classes. Both classes support user and owner passwords. Leaving the owner and user passwords blank will result in no password prompt, but the specified user permissions will be applied.

The StandardSecurity class uses 40 bit encryption and supports 4 user access permissions:

The HighSecurity class uses 128 bit encryption and supports 4 additional user access permissions:

To secure a document you will initialize a security class and set it to the documents setSecurity property.

[Java]
    // Create a 128 bit encryption security object that prevents text copying.
    HighSecurity security = new HighSecurity("owner", "user");
    security.setAllowCopy(false);
    // Add the security object to the document
    document.setSecurity(security);
    

See Also

HighSecurity Class | StandardSecurity Class | DynamicPDF GeneratorJava: Version Features | Programming With Generator for Java