Instance Method

unlockWithPassword:

Attempts to unlock an encrypted document.

Declaration

- (BOOL)unlockWithPassword:(NSString *)password;

Parameters

password

The password to unlock an encrypted document (you cannot lock an unlocked PDF document by using an incorrect password).

Return Value

YES if the specified password unlocks the document, NO otherwise.

Discussion

If the password is correct, this method returns YES, and a PDFDocumentDidUnlockNotification notification is sent. Once unlocked, you cannot use this function to relock the document.

If you attempt to unlock an already unlocked document, one of the following occurs:

  • If the document is unlocked with full owner permissions, unlockWithPassword does nothing and returns YES. The password string is ignored.

  • If the document is unlocked with only user permissions, unlockWithPassword attempts to obtain full owner permissions with the password string. If the string fails, the document maintains its user permissions. In either case, this method returns YES.

See Also

Managing Document Security

isEncrypted

A Boolean value specifying whether the document is encrypted.

isLocked

A Boolean value indicating whether the document is locked.

permissionsStatus

The permissions status of the PDF document.

Permission Properties

Properties that specify what functions are allowed for a PDF document.