Browse Source

【数字签名】添加数字签名,自定义数字签名-图片签名-上传加密文档,点击继续,崩溃 -- 修复

lizhe 10 months ago
parent
commit
86cab288f6

+ 9 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateCustomViewController.swift

@@ -427,6 +427,15 @@ class CDSignatureCertificateCustomViewController: NSViewController, NSTextFieldD
         openPanel.beginSheetModal(for: self.view.window!) { result in
             if result == .OK {
                 let fileURL = openPanel.urls.first
+                let document = CPDFDocument(url: fileURL)
+                if !document!.allowsCopying || !document!.allowsPrinting {
+                    let alert = NSAlert()
+                    alert.alertStyle = .critical
+                    alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+                    alert.runModal()
+                    return
+                }
+                
                 self.appearanceData.signatureConfig.text = ""
                 self.photoImage = NSImage(contentsOf: fileURL!)
                 self.appearanceData.signatureConfig.image = self.photoImage