-3

パスワードで保護されたPDFファイルがあり、PDFKitまたはその他の方法を使用して復号化する必要があります。パスワードでロックを解除すると、ロックは解除されますが、暗号化されたままです。

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
            }
        }
    }
}
4

1 に答える 1