Explorar el Código

【打印】新增保存带水印

tangchao hace 1 año
padre
commit
3296604310

+ 20 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1895,11 +1895,29 @@ extension KMMainViewController {
                 // 隐藏提示
                 self?.hiddenSecureLimitTip()
                 // 去打印
-                KMPrintWindowController.openDocument(inputDocument: self?.listView.document, inputPageRange: pageRange)
+                if let data = self?.saveWatermarkFlag, !data {
+                    KMPrintWindowController.openDocument(inputDocument: self!.listView?.document, inputPageRange: pageRange)
+                    return
+                }
+                if let _url = KMTools.saveWatermarkDocumentToTemp(document: self!.listView.document, secureOptions: self!.secureOptions, removePWD: self!.removeSecureFlag) {
+                    let _document = CPDFDocument(url: _url)
+                    KMPrintWindowController.showPrintWindowControll(inputData: _url, inputDocument: self?.listView.document, inputPageRange: pageRange)
+                } else {
+                    KMPrintWindowController.openDocument(inputDocument: self?.listView?.document, inputPageRange: pageRange)
+                }
             }
             return
         }
-        KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
+        if (!self.saveWatermarkFlag) {
+            KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
+            return
+        }
+        if let _url = KMTools.saveWatermarkDocumentToTemp(document: self.listView.document, secureOptions: self.secureOptions, removePWD: self.removeSecureFlag) {
+            let _document = CPDFDocument(url: _url)
+            KMPrintWindowController.showPrintWindowControll(inputData: _url, inputDocument: self.listView.document, inputPageRange: pageRange)
+        } else {
+            KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: pageRange)
+        }
     }
     
     // MARK: - Split View