Loading Encrypted PDF files

A PDF may be encrypted, and may optionally be protected by a user password and an owner password. TX Text Control handles encryption internally, but the application is responsible for acquiring the respective passwords from the user, and to restrict access to certain operations, like printing or editing, if the passwords are not specified or do not match.

1. User Password

The user password is required to open the document. A FilterException exception with the Reason property set to FilterError.InvalidPassword is thrown when attempting to load a PDF that is protected with a user password. If this exception occurs, the application should ask the user for the password and retry loading the PDF with the password specified in LoadSettings.UserPassword.

If the PDF has been loaded, the LoadSettings.DocumentAccessPermissions flags specify which operations are allowed.

End user applications should disable all operations that are not allowed, for instance by graying out the Print menu item if DocumentAccessPermissions.AllowLowLevelPrinting is not included.

2. Owner Password

The owner password is required to change a PDF files's security settings. Without the correct owner password, a PDF file can be displayed, but editing or printing may be prohibited. If the correct owner password is specified in LoadSettings.MasterPassword, DocumentAccessPermissions.AllowAll will be set after the file has been loaded, and no restrictions apply.

3. Permissions

Access permissions are described in LoadSettings.DocumentAccessPermissions.

4. Encryption Algorithms

PDF files can be encrypted with a variety of encryption algorithms. Supported are:

Not supported are:

A FilterException exception with the Reason property set to FilterError.Encrypted is thrown, if one of the unsupported algorithms is encountered.