Hello,
I need help unlocking Encrypted PDF Documents.
I have tried the following without success.
CFURLRef pdfURL = CFURLCreateWithFileSystemPath (NULL, documentsDirectory, kCFURLPOSIXPathStyle, 0); //1
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
BOOL encrypted = CGPDFDocumentIsEncrypted(pdf);
if (encrypted) {
// Try 1:
const char *str = (char *)theTextField.text;
BOOL _unlock = CGPDFDocumentUnlockWithPassword(pdf,str);
//Try 2:
NSString *str1 = @"password";
BOOL _unlock1 = CGPDFDocumentUnlockWithPassword(pdf,str1);
}
I made sure the password is correct but the unlock function still returns False.
I have forgotten anything? Is there anything wrong??
Regards, Arun Thakkar.