I have a password protected PDF file and I need to Decrypt it using PDFKit or some other way, When I use unlock with password, it is unlocked but it is still encrypted could anyone help me with this code:
func handlePDF(url: URL, password: String) {
print(pdfDocument.isEncrypted, pdfDocument.isLocked) // true, true
if let pdfDocument = PDFDocument(url: url) {
if pdfDocument.isEncrypted {
if pdfDocument.unlock(withPassword: password) {
print(pdfDocument.isEncrypted, pdfDocument.isLocked) //true , false
}
}
}
}