Browse Source

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao 1 year ago
parent
commit
0414552206

+ 44 - 4
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -3586,6 +3586,15 @@
 		BBF62C742B0347D1007B7E86 /* SplitWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF62C732B0347D0007B7E86 /* SplitWindowController.xib */; };
 		BBF62C752B0347D1007B7E86 /* SplitWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF62C732B0347D0007B7E86 /* SplitWindowController.xib */; };
 		BBF62C762B0347D1007B7E86 /* SplitWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF62C732B0347D0007B7E86 /* SplitWindowController.xib */; };
+		BBF811E02B07178F0074874F /* KMExtractImageWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811DF2B07178F0074874F /* KMExtractImageWindowController.swift */; };
+		BBF811E12B07178F0074874F /* KMExtractImageWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811DF2B07178F0074874F /* KMExtractImageWindowController.swift */; };
+		BBF811E22B07178F0074874F /* KMExtractImageWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811DF2B07178F0074874F /* KMExtractImageWindowController.swift */; };
+		BBF811E42B0717970074874F /* KMExtractImageWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF811E32B0717970074874F /* KMExtractImageWindowController.xib */; };
+		BBF811E52B0717970074874F /* KMExtractImageWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF811E32B0717970074874F /* KMExtractImageWindowController.xib */; };
+		BBF811E62B0717970074874F /* KMExtractImageWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBF811E32B0717970074874F /* KMExtractImageWindowController.xib */; };
+		BBF811F12B0763930074874F /* PDFConvertObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811F02B0763930074874F /* PDFConvertObject.swift */; };
+		BBF811F22B0763930074874F /* PDFConvertObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811F02B0763930074874F /* PDFConvertObject.swift */; };
+		BBF811F32B0763930074874F /* PDFConvertObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF811F02B0763930074874F /* PDFConvertObject.swift */; };
 		BBF8A3FA2AE89B8500788BAC /* KMBatchHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A3F92AE89B8500788BAC /* KMBatchHeader.swift */; };
 		BBF8A3FD2AE8B03B00788BAC /* KMBatchOperateFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A3FC2AE8B03B00788BAC /* KMBatchOperateFile.swift */; };
 		BBF8A3FE2AE8B04100788BAC /* KMBatchOperateFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A3FC2AE8B03B00788BAC /* KMBatchOperateFile.swift */; };
@@ -5217,6 +5226,9 @@
 		BBF62C6B2B033B5A007B7E86 /* KMPDFEditExtractWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPDFEditExtractWindow.xib; sourceTree = "<group>"; };
 		BBF62C6F2B0347AF007B7E86 /* SplitWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitWindowController.swift; sourceTree = "<group>"; };
 		BBF62C732B0347D0007B7E86 /* SplitWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SplitWindowController.xib; sourceTree = "<group>"; };
+		BBF811DF2B07178F0074874F /* KMExtractImageWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMExtractImageWindowController.swift; sourceTree = "<group>"; };
+		BBF811E32B0717970074874F /* KMExtractImageWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMExtractImageWindowController.xib; sourceTree = "<group>"; };
+		BBF811F02B0763930074874F /* PDFConvertObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PDFConvertObject.swift; sourceTree = "<group>"; };
 		BBF8A3F92AE89B8500788BAC /* KMBatchHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchHeader.swift; sourceTree = "<group>"; };
 		BBF8A3FC2AE8B03B00788BAC /* KMBatchOperateFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchOperateFile.swift; sourceTree = "<group>"; };
 		BBF8A4002AE8B4E200788BAC /* KMBatchBaseParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchBaseParameter.swift; sourceTree = "<group>"; };
@@ -8087,6 +8099,7 @@
 				BB1A916D2AFB7871005E5FD8 /* KMConvertWindowController.xib */,
 				BB96A0AF2AFCD56100559E24 /* KMToolCompareWindowController.swift */,
 				BB96A0B32AFCD56B00559E24 /* KMToolCompareWindowController.xib */,
+				BB88E4522940458F002B3655 /* Common */,
 			);
 			path = NewController;
 			sourceTree = "<group>";
@@ -8420,9 +8433,8 @@
 		BB3EAEA9293E3BA200D92407 /* Convert */ = {
 			isa = PBXGroup;
 			children = (
-				BB4A94852B0455CF00940F8B /* New Group */,
+				BB4A94852B0455CF00940F8B /* ExtractImage */,
 				BB1A91682AFB7833005E5FD8 /* NewController */,
-				BB88E4522940458F002B3655 /* Common */,
 				BB88E43E2940342B002B3655 /* Library */,
 				BB88E439294023B5002B3655 /* Model */,
 				BB49ECE3293EF50800C82CA2 /* View */,
@@ -8505,11 +8517,13 @@
 			path = Controller;
 			sourceTree = "<group>";
 		};
-		BB4A94852B0455CF00940F8B /* New Group */ = {
+		BB4A94852B0455CF00940F8B /* ExtractImage */ = {
 			isa = PBXGroup;
 			children = (
+				BBF811E82B0731A00074874F /* Controller */,
+				BBF811E72B0731950074874F /* Model */,
 			);
-			path = "New Group";
+			path = ExtractImage;
 			sourceTree = "<group>";
 		};
 		BB4A94862B04565200940F8B /* Model */ = {
@@ -9576,6 +9590,23 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		BBF811E72B0731950074874F /* Model */ = {
+			isa = PBXGroup;
+			children = (
+				BBF811F02B0763930074874F /* PDFConvertObject.swift */,
+			);
+			path = Model;
+			sourceTree = "<group>";
+		};
+		BBF811E82B0731A00074874F /* Controller */ = {
+			isa = PBXGroup;
+			children = (
+				BBF811DF2B07178F0074874F /* KMExtractImageWindowController.swift */,
+				BBF811E32B0717970074874F /* KMExtractImageWindowController.xib */,
+			);
+			path = Controller;
+			sourceTree = "<group>";
+		};
 		BBF8A3F82AE89B6100788BAC /* Tools */ = {
 			isa = PBXGroup;
 			children = (
@@ -10418,6 +10449,7 @@
 				AD0FA4FE29A8DD8700EDEB50 /* KMRegisterSuccessView.xib in Resources */,
 				9F0CB49229683DEE00007028 /* KMPropertiesPanelLineSubVC.xib in Resources */,
 				BBE9D09B2AF0CEEB002E83CE /* KMBatchOperateCompressViewController.xib in Resources */,
+				BBF811E42B0717970074874F /* KMExtractImageWindowController.xib in Resources */,
 				BB8B17362907B64D001C5EA5 /* CipherTextView.xib in Resources */,
 				BBC348562958465C008D2CD1 /* KMBackgroundFilePropertyInfoController.xib in Resources */,
 				ADE86ACC2B034CC000414DFA /* KMAddBackgroundView.xib in Resources */,
@@ -10718,6 +10750,7 @@
 				BBEC00C3295C306400A26C98 /* KMBatesPropertyController.xib in Resources */,
 				BB897262294C5DDA0045787C /* KMWatermarkPropertyInfoController.xib in Resources */,
 				9FDD0F68294AB645000C4DAD /* KMMainViewController.xib in Resources */,
+				BBF811E52B0717970074874F /* KMExtractImageWindowController.xib in Resources */,
 				BBADCF652AF3CB92004ECE0C /* KMWatermarkCollectionViewItem.xib in Resources */,
 				F356720929AF184A00740FF3 /* CPDFListAnnotationNoteWindowController.xib in Resources */,
 				9FDD0FA32952FF4D000C4DAD /* $themes.json in Resources */,
@@ -11193,6 +11226,7 @@
 				89D2D300294C806000BFF5FE /* KMPDFThumbnailItem.xib in Resources */,
 				BB2EDF75296ECE17003BCF58 /* KMPageEditThumbnailItem.xib in Resources */,
 				AD867FAC29DFB78200F00440 /* KMAnnotationOutlineView.xib in Resources */,
+				BBF811E62B0717970074874F /* KMExtractImageWindowController.xib in Resources */,
 				ADC63E452A49817400854E02 /* KMSubscribeSuccessView.xib in Resources */,
 				BB8F4554295A9FA50037EA22 /* KMCreateHeaderFooterController.xib in Resources */,
 				ADBC376329CC637900D93208 /* KMReadModelView.xib in Resources */,
@@ -11487,6 +11521,7 @@
 				BB5DF1E92959C5CB0025CDA1 /* KMHeaderFooterPreviewController.swift in Sources */,
 				9FCFEC702AC40F9B00EAD2CB /* CStampSignatureObject.swift in Sources */,
 				9FDD0F6B294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
+				BBF811E02B07178F0074874F /* KMExtractImageWindowController.swift in Sources */,
 				9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				BB96A0B82AFCE45800559E24 /* WaitingView.swift in Sources */,
 				9FCFECA02AD17B8A00EAD2CB /* SKProgressController.swift in Sources */,
@@ -11614,6 +11649,7 @@
 				BB65A07C2AF8E5A4003A27A0 /* KMLineWell.swift in Sources */,
 				BBD1F793296FE92500343885 /* KMPageEditSplitSettingView.swift in Sources */,
 				BB897241294C028A0045787C /* KMWatermarkAdjectiveSegementControl.swift in Sources */,
+				BBF811F12B0763930074874F /* PDFConvertObject.swift in Sources */,
 				BB5BE4ED2B060E2100D51BF2 /* KMLanguageViewController.swift in Sources */,
 				BBEFD01C2AF9E5AA003FABD8 /* KMBatchOperateAddHeaderFooterViewController.swift in Sources */,
 				9F3D818E29A22AD90087B5AD /* Date+KMExtensions.swift in Sources */,
@@ -12264,6 +12300,7 @@
 				89D9896D28FD50EF003A3E87 /* KMAnnotationCollectionViewItem.swift in Sources */,
 				BB146FDF299DC0D100784A6A /* GTLRDriveObjects.m in Sources */,
 				9F0CB5122986565700007028 /* KMDesignToken+BorderRadius.swift in Sources */,
+				BBF811E12B07178F0074874F /* KMExtractImageWindowController.swift in Sources */,
 				BB86C1EE28F544F4005AD968 /* CPDFListView+Event.m in Sources */,
 				BBF245592AE78D0300037D08 /* KMBatchOperateWindowController.swift in Sources */,
 				9F81ADC729B9B12C002251F4 /* NSButton+DesignToken.swift in Sources */,
@@ -12803,6 +12840,7 @@
 				BBA8B7A42935CD740097D183 /* KMRemovePasswordAlertWindowController.swift in Sources */,
 				BB4EEF4D2976544F003A3537 /* KMRedactAligementView.swift in Sources */,
 				F37322EE292DF9410013862C /* CPDFMarkupAnnotation+PDFListView.m in Sources */,
+				BBF811F22B0763930074874F /* PDFConvertObject.swift in Sources */,
 				9F1FE4FA29406E4700E952CA /* CTTabStripView.m in Sources */,
 				BB31DA632AFA3088006D63CB /* KMPreferenceController.swift in Sources */,
 				9F0CB48829683DC400007028 /* KMPropertiesPanelPresetColorSubVC.swift in Sources */,
@@ -13100,6 +13138,7 @@
 				BBA19F4529ADE6A3001A285A /* KMBookMarkRowView.swift in Sources */,
 				9F0201982A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */,
 				9FDD0FAC29534FCC000C4DAD /* KMAliasLight.swift in Sources */,
+				BBF811E22B07178F0074874F /* KMExtractImageWindowController.swift in Sources */,
 				BBEFD01A2AF9BD24003FABD8 /* KMDataVersionManager.swift in Sources */,
 				BBF38A64294F53FD0086D025 /* KMWatermarkFileView.swift in Sources */,
 				899700F828F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
@@ -13126,6 +13165,7 @@
 				F3F0B27529B8ACD000722957 /* CPDFListViewDragObject.m in Sources */,
 				F34BF9552953DA91002C25A2 /* NSGeometry+PDFListView.m in Sources */,
 				BB853CAC2AF8FA46009C20C1 /* KMHeaderFooterManagerWindowController.swift in Sources */,
+				BBF811F32B0763930074874F /* PDFConvertObject.swift in Sources */,
 				BB897230294B08DE0045787C /* KMWatermarkViewController.swift in Sources */,
 				BB8B17342907B63D001C5EA5 /* CipherTextView.swift in Sources */,
 				ADBC375229CAE27900D93208 /* KMComparativeOutlineRowView.swift in Sources */,

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/ProgressSheet.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="101300" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 10 - 1
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift

@@ -41,6 +41,12 @@ class SKProgressController: NSWindowController {
         return NSNib.Name("ProgressSheet")
     }
     
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        KMPrint("")
+    }
+    
     override func windowDidLoad() {
         super.windowDidLoad()
     
@@ -138,7 +144,7 @@ class SKProgressController: NSWindowController {
 //    }
     
     @IBAction func dismissSheet(_ sender: Any) {
-        self.progressBar.stopAnimation(self)
+        self.stopAnimation()
         
         if #available(macOS 10.13, *) {
             NSApp.endSheet(self.window!, returnCode: (sender as AnyObject).tag)
@@ -148,4 +154,7 @@ class SKProgressController: NSWindowController {
         
         self.window!.orderOut(self)
     }
+    func stopAnimation() {
+        self.progressBar.stopAnimation(self)
+    }
 }

+ 325 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Controller/KMExtractImageWindowController.swift

@@ -0,0 +1,325 @@
+//
+//  KMExtractImageWindowController.swift
+//  PDF Master
+//
+//  Created by liujiajie on 2023/11/17.
+//
+
+import Cocoa
+
+class KMExtractImageWindowController: NSWindowController,PDFConvertObjectDelegate,NSTextFieldDelegate{
+    var docPath: String = ""
+    var password: String = ""
+    var currentPage: Int = 0
+    var maskView: KMBookletMaskView?
+    
+    @IBOutlet var rangeTipLabel: NSTextField!
+    @IBOutlet var rangeTextField: NSTextField!
+    @IBOutlet var allPageButton: NSButton!
+    @IBOutlet var currentPageButton: NSButton!
+    @IBOutlet var singlePageButton: NSButton!
+    @IBOutlet var doublePageButton: NSButton!
+    @IBOutlet var customPageButton: NSButton!
+    @IBOutlet var extractImageButton: NSButton!
+    @IBOutlet var cancelButton: NSButton!
+    @IBOutlet var customTextField: NSTextField!
+    @IBOutlet var totalImagesTextField: NSTextField!
+    lazy var pdfDocument: CPDFDocument? = {
+        var pdfDoc = CPDFDocument(url: URL(fileURLWithPath: self.docPath))
+        if (self.password.count > 0){
+            pdfDoc?.unlock(withPassword: self.password)
+        }
+        return pdfDoc
+    }()
+    var selectPagesIndex: Int = 0
+//    var pdfConverter: PDFConvertObject?
+    lazy var pdfConverter: PDFConvertObject? = {
+        let conerter = PDF_Master.PDFConvertObject()
+        return conerter
+    }()
+    @IBOutlet var currentPageTextField: NSTextField!
+    @IBOutlet var pageCountTextField: NSTextField!
+    @IBOutlet var pdfViewBG: NSView!
+    var preViewPDFView: CPDFView!
+    
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        
+    }
+    override func windowDidLoad() {
+        super.windowDidLoad()
+        let preView: CPDFView = CPDFView(frame: self.pdfViewBG.bounds)
+        self.pdfViewBG.addSubview(preView)
+        self.preViewPDFView = preView
+        configUI()
+    }
+    func configUI() {
+        if !self.docPath.isEmpty && self.docPath.count > 0 {
+            let url = URL(fileURLWithPath: docPath)
+            let document = CPDFDocument(url: url)
+            if self.password.count > 0 {
+                document?.unlock(withPassword: password)
+            }
+            self.preViewPDFView.document = document
+            self.preViewPDFView.autoScales = true
+            self.preViewPDFView.layoutDocumentView()
+            self.preViewPDFView.go(toPageIndex: self.currentPage, animated: true)
+        }
+        self.allPageButton.title = NSLocalizedString("All Pages", comment: "")
+        self.singlePageButton.title = NSLocalizedString("Odd Pages Only", comment: "")
+        self.doublePageButton.title = NSLocalizedString("Even Pages Only", comment: "")
+        self.currentPageButton.title = NSLocalizedString("Current Page", comment: "")
+        self.extractImageButton.title = NSLocalizedString("Extract", comment: "")
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+        self.rangeTextField.placeholderString = NSLocalizedString("e.g. 1,3-5,10", comment: "")
+        self.rangeTipLabel.stringValue = NSLocalizedString("Page Range", comment: "")
+        
+        self.currentPageTextField.stringValue = "\(self.currentPage + 1)"
+        self.pageCountTextField.stringValue = "/ \(self.pdfDocument?.pageCount ?? 0)"
+        self.customTextField.stringValue = self.pageCountTextField.stringValue
+        self.selectPagesIndex = 0
+        
+        self.rangeTextField.isEnabled = false
+        self.customTextField.isEnabled = false
+        self.allPageButton.state = NSControl.StateValue.on
+        if self.pdfDocument?.pageCount ?? 0 < 2 {
+            self.doublePageButton.isEnabled = false
+        } else {
+            self.doublePageButton.isEnabled = true
+        }
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(pageChangeNotification(notification:)), name: NSNotification.Name.PDFViewPageChanged, object: self.preViewPDFView)
+    }
+    func selectCurrentPageBtn() {
+        self.customPageButton_Action(self.currentPageButton)
+    }
+    
+    @IBAction func customPageButton_Action(_ sender: NSButton) {
+        self.allPageButton.state = NSControl.StateValue.off
+        self.currentPageButton.state = NSControl.StateValue.off
+        self.singlePageButton.state = NSControl.StateValue.off
+        self.doublePageButton.state = NSControl.StateValue.off
+        self.customPageButton.state = NSControl.StateValue.off
+        sender.state = NSControl.StateValue.on
+        self.rangeTextField.isEnabled = false
+        self.customTextField.textColor = NSColor.disabledControlTextColor
+        self.selectPagesIndex = sender.tag
+        if sender.tag == 3 {
+            self.rangeTextField.isEnabled = true
+            self.customTextField.textColor = NSColor.labelColor
+            self.window?.makeFirstResponder(self.rangeTextField)
+            if self.rangeTextField.stringValue.isEmpty {
+                return
+            }
+        }
+    }
+    @IBAction func extractImageButton_Action(_ sender: Any) {
+        startExtracting()
+    }
+    @IBAction func cancleButton_Action(_ sender: Any) {
+        self.window?.sheetParent?.endSheet(self.window!)
+    }
+    @IBAction func nextPage_Action(_ sender: Any) {
+        if self.preViewPDFView.canGoToNextPage() {
+            self.preViewPDFView.goToNextPage(sender)
+        }
+        let index = self.preViewPDFView.document.index(for: self.preViewPDFView.currentPage())
+        self.currentPageTextField.stringValue = "\(index + 1)"
+    }
+    @IBAction func previousPage_Action(_ sender: Any) {
+        if self.preViewPDFView.canGoToPreviousPage() {
+            self.preViewPDFView.goToPreviousPage(sender)
+        }
+        let index = self.preViewPDFView.document.index(for: self.preViewPDFView.currentPage())
+        self.currentPageTextField.stringValue = "\(index + 1)"
+    }
+    
+    override func close() {
+        if ((self.window?.isSheet) != nil) {
+            self.window?.sheetParent?.endSheet(self.window!)
+        } else {
+            super.close()
+        }
+    }
+    
+    func startExtracting() {
+        let indeSet = self.selectIndexSet()
+        if indeSet.count == 0 { return }
+        let lastPathName = self.pdfDocument?.documentURL.deletingPathExtension().lastPathComponent ?? ""
+        let tFileName = (String(format: "%@_Extract Images", lastPathName))
+        let outputSavePanel = NSSavePanel()
+        outputSavePanel.title = NSLocalizedString("Save as PDF", comment: "")
+        outputSavePanel.allowsOtherFileTypes = true
+        outputSavePanel.isExtensionHidden = true
+        outputSavePanel.canCreateDirectories = true
+        outputSavePanel.nameFieldStringValue = tFileName
+        outputSavePanel.beginSheetModal(for: self.window!) {(result) in
+            if result == NSApplication.ModalResponse.OK {
+                self.showWaitting()
+                DispatchQueue.main.async { [weak self] in
+                    guard let self = self else { return }
+                    let tDestFile = outputSavePanel.url?.path ?? ""
+                    let uniquePath = KMExtractImageWindowController.createDestFolder(path: tDestFile, isUnique: false)
+                    self.pdfConverter?.extractResourcesFromPDF(at: docPath, pdfPassword: password, selectIndexSet: indeSet as IndexSet, destDocPath: uniquePath, moreOptions: nil)
+                    self.extractOK(tDestFile)
+                }
+            }
+        }
+    }
+    func extractOK(_ folder: String) {
+        self.hideWaitting()
+        self.close()
+        if FileManager.default.fileExists(atPath: folder) {
+            let workspace = NSWorkspace.shared
+            let url = URL(fileURLWithPath: folder)
+            workspace.activateFileViewerSelecting([url])
+        }
+    }
+    func selectIndexSet() -> NSMutableIndexSet {
+        let pageCount = self.pdfDocument?.pageCount
+        let indeSet = NSMutableIndexSet()
+        if self.selectPagesIndex == 0 {
+            for i in 0..<(pageCount ?? 0) {
+                indeSet.add(IndexSet(integer: IndexSet.Element(i)))
+            }
+        } else if self.selectPagesIndex == 1 {
+            for i in 0..<(pageCount ?? 0) {
+                if i % 2 == 0 {
+                    indeSet.add(IndexSet(integer: IndexSet.Element(i)))
+                }
+            }
+        } else if self.selectPagesIndex == 2 {
+            for i in 0..<(pageCount ?? 0) {
+                if i % 2 != 0 {
+                    indeSet.add(IndexSet(integer: IndexSet.Element(i)))
+                }
+            }
+        } else if self.selectPagesIndex == 4 {
+            if let index = self.preViewPDFView.document?.index(for: self.preViewPDFView.currentPage()!) {
+                indeSet.add(IndexSet(integer: IndexSet.Element(index)))
+            }
+        } else {
+            let fileAttribute = KMFileAttribute()
+            fileAttribute.filePath = self.preViewPDFView.document?.documentURL?.path ?? ""
+            fileAttribute.bAllPage = false
+            fileAttribute.pagesString = self.rangeTextField.stringValue
+            if !fileAttribute.fetchSelectPages().isEmpty {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = "\(fileAttribute.filePath.lastPathComponent) \(NSLocalizedString("Invalid page range or the page number is out of range. Please try again.", comment: ""))"
+                alert.runModal()
+                return indeSet
+            }
+            
+            for num in fileAttribute.fetchSelectPages() {
+                indeSet.add(num.intValue-1)
+            }
+        }
+        return indeSet
+    }
+    class func createDestFolder(path: String, isUnique: Bool) -> String { 
+        var ret = true
+        var tUniqueName: String? = nil
+        let tFileManager = FileManager.default
+        if isUnique {
+            tUniqueName = getUniqueFilePath(filePath: path)
+        } else {
+            tUniqueName = path
+        }
+        
+        if !tFileManager.fileExists(atPath: tUniqueName!) {
+            do {
+                try tFileManager.createDirectory(atPath: tUniqueName!, withIntermediateDirectories: true, attributes: nil)
+            } catch {
+                ret = false
+            }
+        }
+        
+        return tUniqueName!
+    }
+    class func getUniqueFilePath(filePath: String) -> String { 
+        var i = 0
+        var isDirectory = ObjCBool(false)
+        var uniqueFilePath = filePath
+        let filemanager = FileManager.default
+        filemanager.fileExists(atPath: uniqueFilePath, isDirectory: &isDirectory)
+        
+        if isDirectory.boolValue {
+            while filemanager.fileExists(atPath: uniqueFilePath) {
+                i += 1
+                uniqueFilePath = "\(filePath)(\(i))"
+            }
+        } else {
+            while filemanager.fileExists(atPath: uniqueFilePath) {
+                i += 1
+                let path = "\(filePath.deletingPathExtension)(\(i))"
+                uniqueFilePath = path.stringByAppendingPathExtension(filePath.customPathExtension)
+            }
+        }
+        
+        return uniqueFilePath
+    }
+    
+    @objc func pageChangeNotification(notification: Notification) {
+        self.currentPageTextField.stringValue = self.preViewPDFView.currentPage().label ?? ""
+    }
+    func controlTextDidEndEditing(_ obj: Notification) {
+        if obj.object as? NSTextField == self.currentPageTextField {
+            if let intValue = Int(self.currentPageTextField.stringValue), intValue > (self.preViewPDFView.document?.pageCount ?? 0) {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@%@", self.preViewPDFView.document.documentURL.lastPathComponent.lastPathComponent,KMLocalizedString("Invalid page range or the page number is out of range. Please try again.", nil))
+                alert.beginSheetModal(for: NSApp.mainWindow!, completionHandler: nil) 
+                return
+            }
+            self.preViewPDFView.go(to: self.preViewPDFView.document?.page(at: UInt((Int(self.currentPageTextField.stringValue) ?? 0) - 1)))
+        } else if obj.object as? NSTextField == self.rangeTextField {
+            if !checkPageRangeValidate(self.rangeTextField.stringValue) {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@%@", self.preViewPDFView.document.documentURL.lastPathComponent.lastPathComponent,KMLocalizedString("Invalid page range or the page number is out of range. Please try again.", nil))
+                alert.beginSheetModal(for: NSApp.mainWindow!, completionHandler: nil)
+                return
+            }
+        }
+    }
+    func checkPageRangeValidate(_ pageRangeString: String) -> Bool { 
+        let fileAttribute = KMFileAttribute()
+        fileAttribute.filePath = self.preViewPDFView.document?.documentURL?.path ?? ""
+        fileAttribute.bAllPage = false
+        fileAttribute.pagesString = self.rangeTextField.stringValue
+        if fileAttribute.fetchSelectPages().isEmpty || fileAttribute.fetchSelectPages().count < 1{
+            return false
+        }
+        return true
+    }
+    override func mouseDown(with event: NSEvent) {
+        super.mouseDown(with: event)
+        self.window?.makeFirstResponder(nil)
+    }
+    @objc func pageChangeNotification(_ notification: Notification) {
+        self.currentPageTextField.stringValue = self.preViewPDFView.currentPage().label ?? ""
+    }
+    func PDFConvertObject(_ converter: PDFConvertObject, didEndConversion error: Error?) {
+        self.hideWaitting() 
+        self.window?.sheetParent?.endSheet(self.window!)
+    }
+    func showWaitting() { 
+        if self.maskView == nil {
+            self.maskView = KMBookletMaskView(frame: CGRect(x: 0, y: 0, width: self.window?.frame.size.width ?? 0, height: self.window?.frame.size.height ?? 0))
+        }
+        self.window?.contentView?.addSubview(self.maskView!)
+    }
+    func hideWaitting() {
+        self.maskView?.removeFromSuperview()
+    }
+    func beginSheetModal(for window: NSWindow, completionHandler handler: ((NSInteger) -> Void)?) {
+        self.window?.beginSheet(window, completionHandler: { returnCode in
+            NSApp.endSheet(self.window!, returnCode: NSApplication.ModalResponse.abort.rawValue)
+            if let handler = handler {
+                handler(returnCode.rawValue)
+            }
+        })
+    }
+   
+}

+ 285 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Controller/KMExtractImageWindowController.xib

@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMExtractImageWindowController">
+            <connections>
+                <outlet property="allPageButton" destination="fGc-Jb-twS" id="Gou-NM-Y6Y"/>
+                <outlet property="cancelButton" destination="U2r-WX-MWr" id="PIv-P7-O5x"/>
+                <outlet property="currentPageButton" destination="4uk-a5-29Y" id="i7c-1a-U6Z"/>
+                <outlet property="currentPageTextField" destination="KHk-2c-1Ze" id="XIB-mW-JXG"/>
+                <outlet property="customPageButton" destination="21L-76-gVO" id="euH-pH-xeF"/>
+                <outlet property="customTextField" destination="zv6-oO-IdL" id="u8u-3h-LE4"/>
+                <outlet property="doublePageButton" destination="10w-qu-XYA" id="rri-oc-AM0"/>
+                <outlet property="extractImageButton" destination="Z30-wQ-Pyx" id="lJT-4d-rLV"/>
+                <outlet property="pageCountTextField" destination="xbI-UW-pTy" id="4jP-as-W9h"/>
+                <outlet property="pdfViewBG" destination="eqc-DH-dLf" id="B4d-Pd-Tbc"/>
+                <outlet property="rangeTextField" destination="dWn-uO-q8r" id="2lw-wv-OTO"/>
+                <outlet property="rangeTipLabel" destination="bEa-uY-xz2" id="BZn-1Z-0e7"/>
+                <outlet property="singlePageButton" destination="2Dk-dY-K3x" id="QUF-L5-DS9"/>
+                <outlet property="totalImagesTextField" destination="MtV-Dv-21E" id="VMd-Us-Gkr"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="615" height="427"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <view key="contentView" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="615" height="427"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bEa-uY-xz2">
+                        <rect key="frame" x="286" y="389" width="37" height="16"/>
+                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="R6D-ab-ahD">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Z30-wQ-Pyx">
+                        <rect key="frame" x="513" y="13" width="75" height="32"/>
+                        <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="m1D-HD-mdF">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                        </buttonCell>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="20" id="8ps-dr-hvn"/>
+                        </constraints>
+                        <connections>
+                            <action selector="extractImageButton_Action:" target="-2" id="il5-7I-GSQ"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="U2r-WX-MWr">
+                        <rect key="frame" x="444" y="13" width="75" height="32"/>
+                        <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="V9x-Ai-YHG">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="cancleButton_Action:" target="-2" id="aCP-GL-ddb"/>
+                        </connections>
+                    </button>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="eqc-DH-dLf">
+                        <rect key="frame" x="22" y="85" width="240" height="320"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="240" id="Ybh-sG-qsQ"/>
+                            <constraint firstAttribute="height" constant="320" id="pEx-Ir-kWo"/>
+                        </constraints>
+                    </customView>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="83o-Pq-4ks">
+                        <rect key="frame" x="40" y="46" width="26" height="26"/>
+                        <buttonCell key="cell" type="round" title="Button" bezelStyle="circular" image="NSGoLeftTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="v3Z-LC-LHv">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="previousPage_Action:" target="-2" id="nLQ-tq-G2A"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q67-eB-W4S">
+                        <rect key="frame" x="219" y="46" width="26" height="26"/>
+                        <buttonCell key="cell" type="round" bezelStyle="circular" image="NSGoRightTemplate" imagePosition="only" alignment="center" borderStyle="border" inset="2" id="8Lh-c9-rZq">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="nextPage_Action:" target="-2" id="YQr-Wa-Yhe"/>
+                        </connections>
+                    </button>
+                    <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="etD-b0-mRt">
+                        <rect key="frame" x="279" y="244" width="319" height="146"/>
+                        <view key="contentView" id="gah-ql-H7S">
+                            <rect key="frame" x="4" y="5" width="311" height="138"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fGc-Jb-twS">
+                                    <rect key="frame" x="8" y="112" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Npc-6e-9Gz">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="customPageButton_Action:" target="-2" id="rVn-zm-UKc"/>
+                                    </connections>
+                                </button>
+                                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Dk-dY-K3x">
+                                    <rect key="frame" x="8" y="62" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="j0r-ED-Z9m">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="customPageButton_Action:" target="-2" id="Rzi-oZ-F1l"/>
+                                    </connections>
+                                </button>
+                                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="21L-76-gVO">
+                                    <rect key="frame" x="8" y="14" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="GW7-IK-iDY">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="customPageButton_Action:" target="-2" id="unU-dM-sVe"/>
+                                    </connections>
+                                </button>
+                                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="10w-qu-XYA">
+                                    <rect key="frame" x="8" y="38" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="g0X-RY-5Nn">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="customPageButton_Action:" target="-2" id="DPP-a0-SNk"/>
+                                    </connections>
+                                </button>
+                                <button tag="4" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4uk-a5-29Y">
+                                    <rect key="frame" x="8" y="86" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="F6v-gm-24n">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="customPageButton_Action:" target="-2" id="oZH-pY-G3P"/>
+                                    </connections>
+                                </button>
+                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dWn-uO-q8r">
+                                    <rect key="frame" x="30" y="13" width="200" height="21"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="200" id="iep-TD-78n"/>
+                                    </constraints>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="mN0-xw-rsx">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                    <connections>
+                                        <outlet property="delegate" destination="-2" id="BH3-Qb-ZVF"/>
+                                    </connections>
+                                </textField>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zv6-oO-IdL">
+                                    <rect key="frame" x="234" y="15" width="20" height="16"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/ 0" id="yTk-ZC-8ZZ">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="4uk-a5-29Y" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" constant="10" id="0rD-Vq-WpE"/>
+                                <constraint firstItem="fGc-Jb-twS" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" constant="10" id="4k2-7n-94F"/>
+                                <constraint firstItem="dWn-uO-q8r" firstAttribute="leading" secondItem="21L-76-gVO" secondAttribute="trailing" constant="6" id="BVh-SI-dRm"/>
+                                <constraint firstItem="dWn-uO-q8r" firstAttribute="centerY" secondItem="21L-76-gVO" secondAttribute="centerY" id="FCE-Gt-npi"/>
+                                <constraint firstItem="2Dk-dY-K3x" firstAttribute="top" secondItem="4uk-a5-29Y" secondAttribute="bottom" constant="10" id="FEG-44-rZj"/>
+                                <constraint firstItem="fGc-Jb-twS" firstAttribute="top" secondItem="gah-ql-H7S" secondAttribute="top" constant="10" id="SET-lE-A1m"/>
+                                <constraint firstItem="2Dk-dY-K3x" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" constant="10" id="UEG-rg-HRz"/>
+                                <constraint firstItem="10w-qu-XYA" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" constant="10" id="WQK-3n-C4d"/>
+                                <constraint firstItem="4uk-a5-29Y" firstAttribute="top" secondItem="fGc-Jb-twS" secondAttribute="bottom" constant="12" id="Zhp-0R-ouM"/>
+                                <constraint firstItem="10w-qu-XYA" firstAttribute="top" secondItem="2Dk-dY-K3x" secondAttribute="bottom" constant="10" id="fLF-uk-kDt"/>
+                                <constraint firstItem="21L-76-gVO" firstAttribute="top" secondItem="10w-qu-XYA" secondAttribute="bottom" constant="10" id="hNi-oD-vho"/>
+                                <constraint firstItem="zv6-oO-IdL" firstAttribute="leading" secondItem="dWn-uO-q8r" secondAttribute="trailing" constant="6" id="pVT-Z5-1xe"/>
+                                <constraint firstItem="zv6-oO-IdL" firstAttribute="centerY" secondItem="dWn-uO-q8r" secondAttribute="centerY" id="rdw-1G-vva"/>
+                                <constraint firstItem="21L-76-gVO" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" constant="10" id="sVO-0h-LtV"/>
+                                <constraint firstAttribute="bottom" secondItem="dWn-uO-q8r" secondAttribute="bottom" constant="13" id="te2-T3-HHD"/>
+                            </constraints>
+                        </view>
+                    </box>
+                    <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MtV-Dv-21E">
+                        <rect key="frame" x="281" y="224" width="85" height="16"/>
+                        <textFieldCell key="cell" lineBreakMode="clipping" title="Total Images:" id="X6M-iS-t1y">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <box boxType="custom" borderWidth="0.0" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Qhz-dw-Bys">
+                        <rect key="frame" x="100" y="49" width="85" height="20"/>
+                        <view key="contentView" id="VhF-eO-l5u">
+                            <rect key="frame" x="0.0" y="0.0" width="85" height="20"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KHk-2c-1Ze">
+                                    <rect key="frame" x="0.0" y="0.0" width="64" height="22"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="22" id="4KQ-Rd-do3"/>
+                                        <constraint firstAttribute="width" constant="64" id="Dkw-N6-Tl8"/>
+                                    </constraints>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" drawsBackground="YES" id="F0w-x1-U2r">
+                                        <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" groupingSize="0" minimumIntegerDigits="0" maximumIntegerDigits="42" id="X3m-Xo-oLf">
+                                            <real key="minimum" value="1"/>
+                                        </numberFormatter>
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                    <connections>
+                                        <outlet property="delegate" destination="-2" id="Jma-Q5-ZOa"/>
+                                    </connections>
+                                </textField>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xbI-UW-pTy">
+                                    <rect key="frame" x="67" y="2" width="20" height="18"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/ 0" id="PeK-t2-39O">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="KHk-2c-1Ze" firstAttribute="leading" secondItem="VhF-eO-l5u" secondAttribute="leading" id="GQh-Ly-v7l"/>
+                                <constraint firstAttribute="bottom" secondItem="xbI-UW-pTy" secondAttribute="bottom" constant="2" id="LfP-4f-2Aa"/>
+                                <constraint firstItem="xbI-UW-pTy" firstAttribute="leading" secondItem="KHk-2c-1Ze" secondAttribute="trailing" constant="5" id="TZ1-d6-FAd"/>
+                                <constraint firstItem="KHk-2c-1Ze" firstAttribute="top" secondItem="VhF-eO-l5u" secondAttribute="top" id="a0K-Cz-RYj"/>
+                                <constraint firstAttribute="bottom" secondItem="KHk-2c-1Ze" secondAttribute="bottom" id="c9e-DG-dFJ"/>
+                                <constraint firstItem="xbI-UW-pTy" firstAttribute="top" secondItem="VhF-eO-l5u" secondAttribute="top" constant="2" id="mN2-W3-L2v"/>
+                                <constraint firstAttribute="trailing" secondItem="xbI-UW-pTy" secondAttribute="trailing" id="uWR-2q-kJ0"/>
+                                <constraint firstAttribute="bottom" secondItem="KHk-2c-1Ze" secondAttribute="bottom" id="xyX-7x-dxw"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="20" id="dIA-rE-hjk"/>
+                        </constraints>
+                    </box>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="eqc-DH-dLf" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="22" id="AB8-wz-gaX"/>
+                    <constraint firstItem="MtV-Dv-21E" firstAttribute="leading" secondItem="gah-ql-H7S" secondAttribute="leading" id="AqE-QZ-ouw"/>
+                    <constraint firstItem="Q67-eB-W4S" firstAttribute="leading" secondItem="Qhz-dw-Bys" secondAttribute="trailing" constant="37" id="Fnv-Y6-oWk"/>
+                    <constraint firstItem="eqc-DH-dLf" firstAttribute="centerX" secondItem="Qhz-dw-Bys" secondAttribute="centerX" id="Hbi-9T-24v"/>
+                    <constraint firstItem="83o-Pq-4ks" firstAttribute="centerY" secondItem="Qhz-dw-Bys" secondAttribute="centerY" id="KRw-GR-c8T"/>
+                    <constraint firstItem="etD-b0-mRt" firstAttribute="top" secondItem="bEa-uY-xz2" secondAttribute="bottom" constant="1" id="LBa-OM-pvs"/>
+                    <constraint firstItem="Qhz-dw-Bys" firstAttribute="top" secondItem="eqc-DH-dLf" secondAttribute="bottom" constant="16" id="ML1-Cr-LXj"/>
+                    <constraint firstItem="MtV-Dv-21E" firstAttribute="top" secondItem="etD-b0-mRt" secondAttribute="bottom" constant="8" id="MNg-HN-YHC"/>
+                    <constraint firstItem="Q67-eB-W4S" firstAttribute="centerY" secondItem="Qhz-dw-Bys" secondAttribute="centerY" id="N4W-OS-Z4R"/>
+                    <constraint firstAttribute="trailing" secondItem="etD-b0-mRt" secondAttribute="trailing" constant="20" id="RE6-Nu-f2L"/>
+                    <constraint firstAttribute="trailing" secondItem="Z30-wQ-Pyx" secondAttribute="trailing" constant="34" id="T41-FH-3CM"/>
+                    <constraint firstItem="U2r-WX-MWr" firstAttribute="centerY" secondItem="Z30-wQ-Pyx" secondAttribute="centerY" id="baj-eB-2pd"/>
+                    <constraint firstItem="Z30-wQ-Pyx" firstAttribute="leading" secondItem="U2r-WX-MWr" secondAttribute="trailing" constant="8" id="e8g-pE-ppN"/>
+                    <constraint firstItem="83o-Pq-4ks" firstAttribute="top" secondItem="eqc-DH-dLf" secondAttribute="bottom" constant="16" id="gqV-fk-saK"/>
+                    <constraint firstItem="eqc-DH-dLf" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="22" id="nXb-sd-Swo"/>
+                    <constraint firstItem="Qhz-dw-Bys" firstAttribute="leading" secondItem="83o-Pq-4ks" secondAttribute="trailing" constant="37" id="pW9-GJ-JKO"/>
+                    <constraint firstItem="bEa-uY-xz2" firstAttribute="top" secondItem="eqc-DH-dLf" secondAttribute="top" id="qNp-uv-XRD"/>
+                    <constraint firstAttribute="bottom" secondItem="Z30-wQ-Pyx" secondAttribute="bottom" constant="20" id="r3M-cz-Zaj"/>
+                    <constraint firstItem="bEa-uY-xz2" firstAttribute="leading" secondItem="eqc-DH-dLf" secondAttribute="trailing" constant="26" id="vfq-KG-GVZ"/>
+                    <constraint firstItem="etD-b0-mRt" firstAttribute="leading" secondItem="eqc-DH-dLf" secondAttribute="trailing" constant="20" id="vwD-ps-jsa"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="212.5" y="233.5"/>
+        </window>
+    </objects>
+    <resources>
+        <image name="NSGoLeftTemplate" width="12" height="17"/>
+        <image name="NSGoRightTemplate" width="12" height="17"/>
+    </resources>
+</document>

+ 67 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Model/PDFConvertObject.swift

@@ -0,0 +1,67 @@
+//
+//  PDFConvertObject.swift
+//  PDF Master
+//
+//  Created by liujiajie on 2023/11/17.
+//
+
+import Foundation
+
+@objc(PDFConvertObjectDelegate)
+protocol PDFConvertObjectDelegate: AnyObject {
+    @objc optional func PDFConvertObjectDidStartConversion(_ converter: PDFConvertObject, error: Error?)
+    @objc optional func PDFConvertObjectDidEndConversion(_ converter: PDFConvertObject, error: Error?)
+    @objc optional func PDFConvertObjectDidPdfPage(_ converter: PDFConvertObject, didPDFPageIndexA: Int, didPageCountA: Int)
+}
+
+class PDFConvertObject: NSObject{
+    var delegate: PDFConvertObjectDelegate?
+    var document: CPDFDocument?
+    lazy var suffix: Int = {
+        if suffix == 0 {
+            var suf = self.document?.pageCount
+            while suf ?? 0 > 10 {
+                suf! /= 10
+                suffix += 1
+            }
+            suffix += 1
+        }
+        return suffix
+    }()
+    
+    override init() {
+        super.init()
+        suffix = 0
+    }
+    
+    func stopConversionIfNeeded() {
+        self.document?.cancelExtractImage()
+    }
+    func extractResourcesFromPDF(at pdfPathA: String, pdfPassword pdfPasswordA: String?, selectIndexSet indexSet: IndexSet, destDocPath destDocPathA: String, moreOptions moreOptionsA: [AnyHashable: Any]?) {
+        self.document = CPDFDocument(url: URL(fileURLWithPath: pdfPathA))
+        if let pdfPassword = pdfPasswordA {
+            self.document?.unlock(withPassword: pdfPassword)
+        }
+        self.document?.extractImage(fromPages: indexSet, toPath: destDocPathA) { (pageIndex, imageIndex, index) -> String? in
+            let fileName = self.document?.documentURL.lastPathComponent.deletingPathExtension
+            let imageName = String(format: "%@_Page%ld_%@", fileName ?? "",pageIndex+1,self.imageNumberSuffix(imageIndex+1))
+            return imageName
+        }
+        
+        self.delegate?.PDFConvertObjectDidEndConversion?(self, error: nil)
+    }
+    func imageNumberSuffix(_ imageIndex: Int) -> String {
+        let indexString = "(imageIndex)"
+        var suffixString = ""
+        if suffix > indexString.count {
+            for _ in 0..<(suffix - indexString.count) {
+                suffixString = "(suffixString)0"
+            }
+            suffixString = "(suffixString)(indexString)"
+            return suffixString
+        }
+        suffixString = indexString
+        return suffixString
+    }
+}
+

PDF Office/PDF Master/Class/PDFTools/Convert/Common/Base/KMConvertBaseView.swift → PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/Base/KMConvertBaseView.swift


PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManager.swift → PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/KMConvertPDFManager.swift


PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMPDFConvert.swift → PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/KMPDFConvert.swift


PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMPDFConvertManager.swift → PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/KMPDFConvertManager.swift


+ 6 - 6
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.xib

@@ -90,7 +90,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="ioL-gH-agJ">
                                 <rect key="frame" x="155" y="10" width="56" height="22"/>
                                 <subviews>
-                                    <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SOc-Qh-Bb7">
+                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SOc-Qh-Bb7">
                                         <rect key="frame" x="0.0" y="0.0" width="40" height="22"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="22" id="3Jq-m9-DeQ"/>
@@ -105,7 +105,7 @@
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z3E-2c-R0k">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z3E-2c-R0k">
                                         <rect key="frame" x="38" y="3" width="20" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/ 0" id="DYY-wZ-Qj3">
                                             <font key="font" metaFont="system"/>
@@ -149,7 +149,7 @@
                             <rect key="frame" x="0.0" y="0.0" width="320" height="106"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A06-uc-UOW">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A06-uc-UOW">
                                     <rect key="frame" x="8" y="90" width="47" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Format" id="I6C-fa-6mM">
                                         <font key="font" metaFont="system"/>
@@ -214,7 +214,7 @@
                                                     <constraint firstAttribute="width" constant="20" id="uhJ-3t-Ju2"/>
                                                 </constraints>
                                             </button>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ckr-Wn-5Tf">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ckr-Wn-5Tf">
                                                 <rect key="frame" x="23" y="0.0" width="279" height="34"/>
                                                 <textFieldCell key="cell" title="Export PDF to Word and other Microsoft Office formats" id="sBS-zf-jgA">
                                                     <font key="font" metaFont="system"/>
@@ -350,7 +350,7 @@ Gw
                                         <action selector="buttonClicked_PageSelect:" target="-2" id="GvJ-gr-WLP"/>
                                     </connections>
                                 </button>
-                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="y8I-4d-Yvk">
+                                <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="y8I-4d-Yvk">
                                     <rect key="frame" x="24" y="10" width="154" height="21"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="bpr-eQ-jls">
                                         <font key="font" metaFont="system"/>
@@ -543,7 +543,7 @@ Gw
                             <action selector="buttonClicked_extractTable:" target="-2" id="0No-NT-2vF"/>
                         </connections>
                     </button>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQ6-L6-IW2">
+                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQ6-L6-IW2">
                         <rect key="frame" x="379" y="314" width="37" height="16"/>
                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="8X0-Hn-fJf">
                             <font key="font" metaFont="system"/>

+ 108 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1986,6 +1986,113 @@ extension KMMainViewController {
         self.km_beginSheet(windowC: com)
     }
     
+    //MARK: 导出图片
+    func extractImageAction(num: Int) {
+        if !(self.listView.document.allowsPrinting || self.listView.document.allowsCopying) {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+            alert.runModal()
+            return
+        }
+        //        if sender is KMToolbarItem {
+        //            (sender as! KMToolbarItem).isSelected = false
+        //        }
+        
+        //        if !IAPProductsManager.defaultManager.isAvailableAllFunction {
+        //            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        //            return
+        //        }
+        
+        let document = self.listView.document
+        var fileURL = document?.documentURL
+        
+        if num == 1 {
+            let pageCount = self.document?.pageCount ?? 0
+            var indeSet = NSMutableIndexSet()
+
+            indeSet.add(in: NSRange(location: 0, length: Int(pageCount)))
+            if indeSet.count == 0 {
+                return
+            }
+            let lastPathName = fileURL?.deletingPathExtension().lastPathComponent ?? ""
+            let tFileName = (String(format: "%@_Extract Images", lastPathName))
+            let outputSavePanel = NSSavePanel()
+            outputSavePanel.title = NSLocalizedString("Save as PDF", comment: "")
+            outputSavePanel.allowsOtherFileTypes = true
+            outputSavePanel.isExtensionHidden = true
+            outputSavePanel.canCreateDirectories = true
+            outputSavePanel.nameFieldStringValue = tFileName
+            outputSavePanel.beginSheetModal(for: self.view.window!, completionHandler: { (result) in
+                if result == NSApplication.ModalResponse.OK {
+                    DispatchQueue.main.async {
+                        self.beginProgressSheet(withMessage: NSLocalizedString("Extracting all pictures...", comment: "") + "...", maxValue: 0)
+                        let tDestFile = outputSavePanel.url!.path
+                        let uniquePath = KMExtractImageWindowController.createDestFolder(path: tDestFile, isUnique: false)
+                        let pdfconverter = PDFConvertObject()
+                        pdfconverter.extractResourcesFromPDF(at: fileURL?.path ?? "", pdfPassword: document?.password, selectIndexSet: indeSet as IndexSet, destDocPath: uniquePath, moreOptions: nil)
+                        self.dismissProgressSheet()
+                        let fileManager = FileManager.default
+                        if fileManager.fileExists(atPath: tDestFile) {
+                            let workspace = NSWorkspace.shared
+                            let url = URL(fileURLWithPath: tDestFile)
+                            workspace.activateFileViewerSelecting([url])
+                        }
+                    }
+                }
+            })
+            return
+        }
+        
+        if fileURL != nil {
+            self.myDocument?.save(nil)
+        } else {
+            let myDocument = self.myDocument
+            let str = String(format: "%@.pdf", myDocument?.displayName ?? "")
+            let writeSuccess = self.document!.write(to: URL(fileURLWithPath: (kTempSavePath?.stringByAppendingPathComponent(str))!))
+            if writeSuccess {
+                var documentTemp = CPDFDocument(url: URL(fileURLWithPath: (kTempSavePath?.stringByAppendingPathComponent(str))!))
+                fileURL = self.document?.documentURL
+            } else {
+                NSSound.beep()
+                return
+            }
+        }
+        let extract = KMExtractImageWindowController(windowNibName: "KMExtractImageWindowController")
+        extract.docPath = fileURL?.path ?? ""
+        extract.password = document?.password ?? ""
+        extract.currentPage = self.listView.currentPageIndex - 1
+//        extract.beginSheetModal(for: NSApp.mainWindow!, completionHandler: nil)
+        self.km_beginSheet(windowC: extract)
+        extract.selectCurrentPageBtn()
+    }
+    
+    func beginProgressSheet(withMessage message: String, maxValue: UInt) {
+//        if progressController == nil {
+//            progressController = SKProgressController(windowNibName: "ProgressSheet")
+//        }
+        let progress = SKProgressController()
+        progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
+        progress.message = NSLocalizedString("Converting...", comment: "")
+        progressController = progress
+        progressController?.message = message
+        if maxValue > 0 {
+            progressController?.indeterminate = false
+            progressController?.maxValue = Double(maxValue)
+        } else {
+            progressController?.indeterminate = true
+        }
+        self.km_beginSheet(windowC: progressController!)
+    }
+    
+    func dismissProgressSheet() {
+        progressController?.stopAnimation()
+        self.km_endSheet()
+        progressController = nil
+    }
     
     func converFilesToPath(files: Array<KMBatchOperateFile>) -> [String] {
         let newArr = NSMutableArray()
@@ -3158,6 +3265,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
             convertToImg(index: index)
         } else if (toolbarItem.itemIdentifier == KMToolbarConversionExportImageItemIdentifier) {
             KMPrint("KMToolbarConversionExportImageItemIdentifier \(index)")
+            extractImageAction(num: index)
         } else if (toolbarItem.itemIdentifier == KMToolbarConversionCreatePDFItemIdentifier) {
             KMPrint("KMToolbarConversionCreatePDFItemIdentifier \(index)")
             self.createPdf(index: index)

+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -43,10 +43,6 @@
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Qt3-H1-Txz">
                     <rect key="frame" x="667" y="347" width="1" height="1"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="0.10000000000000001" id="3Ah-UW-M3a"/>
-                        <constraint firstAttribute="width" constant="0.10000000000000001" id="Iz6-2Y-Kn5"/>
-                    </constraints>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="RgE-Pm-Sre">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
@@ -54,6 +50,10 @@
 Gw
 </string>
                     </buttonCell>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="0.10000000000000001" id="3Ah-UW-M3a"/>
+                        <constraint firstAttribute="width" constant="0.10000000000000001" id="Iz6-2Y-Kn5"/>
+                    </constraints>
                     <connections>
                         <action selector="exitFullScreen:" target="-2" id="eVN-b0-2s4"/>
                     </connections>
@@ -230,7 +230,7 @@ Gw
                     </constraints>
                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_tip_info_small" id="OeM-gK-2cL"/>
                 </imageView>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wp0-L3-5I3">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wp0-L3-5I3">
                     <rect key="frame" x="21" y="8" width="734" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Please use the scroll bar, thumbnail tool to locate the target page, click or box the area to select the target range." id="P3j-kh-acn">
                         <font key="font" metaFont="system" size="14"/>