Browse Source

【编辑工具-背景】保存的文件名错误,应该去掉后缀名 -- 修复

lizhe 11 months ago
parent
commit
00fd3ad6eb

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/New/View/KMHeaderFooterView.swift

@@ -1206,9 +1206,9 @@ extension KMHeaderFooterView {
             
             var fileName: String?
             if isBates {
-                fileName = "\(pdfDocument.documentURL?.lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Bates"
+                fileName = "\(pdfDocument.documentURL?.deletingPathExtension().lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Bates"
             } else {
-                fileName = "\(pdfDocument.documentURL?.lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Header_Footer"
+                fileName = "\(pdfDocument.documentURL?.deletingPathExtension().lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Header_Footer"
             }
             
             let savePanelAccessoryViewController = KMSavePanelAccessoryController()

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Background/New/View/KMAddBackgroundView.swift

@@ -981,7 +981,7 @@ extension KMAddBackgroundView {
             }
             operateCallBack?(originalBackground, currentType)
         case .use:
-            let fileName = "\(pdfDocument.documentURL?.lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Background"
+            let fileName = "\(pdfDocument.documentURL?.deletingPathExtension().lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Background"
             let savePanelAccessoryViewController = KMSavePanelAccessoryController()
             let savePanel = NSSavePanel()
             savePanel.nameFieldStringValue = fileName

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Watermark/New/View/KMWatermarkView.swift

@@ -850,7 +850,7 @@ extension KMWatermarkView {
             
             self.cancelAction?(self)
         } else if self.type == .use {
-            let fileName = "\(self.pdfDocument?.documentURL.lastPathComponent ?? "Untitled")_Watermark"
+            let fileName = "\(pdfDocument.documentURL?.deletingPathExtension().lastPathComponent ?? NSLocalizedString("Untitled", comment: ""))_Watermark"
             let savePanelAccessoryViewController = KMSavePanelAccessoryController()
             let savePanel = NSSavePanel()
             savePanel.nameFieldStringValue = fileName