THotPDF.UserPassword Property

 

THotPDF.UserPassword

THotPDF

 

Top  Previous  Next

Determines document user password.

 

Delphi syntax:

property UserPassword: AnsiString;

 

C++ syntax:

__property AnsiString UserPassword;

 

Description

Opening the document with the correct user password (or opening a document that does not have a user password) allows additional operations to be performed according to the user access permissions specified in the document's encryption dictionary

 

If a user attempts to open an encrypted document that has a user password, the viewer application should prompt for a password. Correctly supplying either password allows the user to open the document, and display it on the screen. If the document does not have a user password, no password is requested;

 

Under AES-256 encryption (revision 5 or 6) the password is read as UTF-8 and only its first 127 bytes count, as ISO 32000-2 defines. HotPDF converts the AnsiString from its code page - normally the system one - so a password carrying non-ASCII letters opens the file in any conforming reader. Letters the code page cannot hold are lost when a Unicode string is assigned to this AnsiString property. RC4 and AES-128 take the password bytes as given

 

Code Example

HPDF.OwnerPassword := 'password';          // Set owner password (required to change security settings)
HPDF.UserPassword := 'user';               // Set user password (required to open the document)
HPDF.ProtectOptions := [prPrint, prInformationCopy]; // Allow printing and copying only
HPDF.ActivateProtection := true;           // Enable PDF security

 

See also: ActivateProtection, CryptKeyLength, OwnerPassword, ProtectOptions