objective c - Cocoa PDFKit Unlocking Encrypted Files -
I have a PDF document in which the owner is set password but there is no user password so it is encrypted.
I want to know the owner's password and use PDFKit to confirm when the document has been decrypted.
When I use the PDFDocument unlockWithPassword method which is the answer yes the file is unlocked although this method also gives yes when the file is unlocked by a user password and not the owner password.
The unlockWithPassword method does not appear to be the state of the isEncrpyted method which I tried to use to define decryption to change.
I want the file decrpyt so that I can use the method of writing, there is no security to write a new file. At the moment, when calling this method on document object results, call in a file with zero length. I think this is due to the encryption.
I'm going about this in the right way or I should use a different way to decrypt the pdf file.
Once you unlock the PDF, you have to write it back to a file using it Required:
writeToFile: withOptions:
or
writeToURL: withOptions:
Option being a nsDictionary
.
According to Apple :. The most commonly used options are kCGPDFContextOwnerPassword, kCGPDFContextUserPassword, kCGPDFContextAllowsCopying and kCGPDFContextAllowsPrinting
"For more information about these options, helpful dictionary key CGPDFContext reference In, quartz 2D is part of the reference. "
Comments
Post a Comment