I need help unlocking encrypted PDFs.
I tried the following without success.
CFURLRef pdfURL = CFURLCreateWithFileSystemPath (NULL, documentsDirectory, kCFURLPOSIXPathStyle, 0);
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
BOOL encrypted = CGPDFDocumentIsEncrypted(pdf);
if (encrypted) {
const char *str = (char *)theTextField.text;
BOOL _unlock = CGPDFDocumentUnlockWithPassword(pdf,str);
NSString *str1 = @"password";
BOOL _unlock1 = CGPDFDocumentUnlockWithPassword(pdf,str1);
}
I made sure the password is correct, but the unlock function still returns False.
Did I forget something? Something is wrong??
Regards, Arun Thakkar
source
share