Преглед на файлове

【页面编辑】KMPDFInsertWindowController OC转Swift

tangchao преди 1 година
родител
ревизия
b93f976420

+ 16 - 0
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -3543,6 +3543,12 @@
 		BBBE208F2B2164CD00509C4E /* KMPDFEditWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE208E2B2164CD00509C4E /* KMPDFEditWindowController.xib */; };
 		BBBE20902B2164CD00509C4E /* KMPDFEditWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE208E2B2164CD00509C4E /* KMPDFEditWindowController.xib */; };
 		BBBE20912B2164CD00509C4E /* KMPDFEditWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE208E2B2164CD00509C4E /* KMPDFEditWindowController.xib */; };
+		BBBE20932B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBE20922B21B18900509C4E /* KMPDFInsertWindowController.swift */; };
+		BBBE20942B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBE20922B21B18900509C4E /* KMPDFInsertWindowController.swift */; };
+		BBBE20952B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBE20922B21B18900509C4E /* KMPDFInsertWindowController.swift */; };
+		BBBE20972B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE20962B21B1DE00509C4E /* KMPDFInsertWindowController.xib */; };
+		BBBE20982B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE20962B21B1DE00509C4E /* KMPDFInsertWindowController.xib */; };
+		BBBE20992B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBBE20962B21B1DE00509C4E /* KMPDFInsertWindowController.xib */; };
 		BBBF68802A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBF687F2A3BF17F0058E14E /* KMFilePromiseProvider.swift */; };
 		BBBF68812A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBF687F2A3BF17F0058E14E /* KMFilePromiseProvider.swift */; };
 		BBBF68822A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBF687F2A3BF17F0058E14E /* KMFilePromiseProvider.swift */; };
@@ -5536,6 +5542,8 @@
 		BBBB6CDD2AD174080035AA66 /* CPDFInkAnnotation+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFInkAnnotation+PDFListView.swift"; sourceTree = "<group>"; };
 		BBBE208A2B21649100509C4E /* KMPDFEditWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFEditWindowController.swift; sourceTree = "<group>"; };
 		BBBE208E2B2164CD00509C4E /* KMPDFEditWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPDFEditWindowController.xib; sourceTree = "<group>"; };
+		BBBE20922B21B18900509C4E /* KMPDFInsertWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFInsertWindowController.swift; sourceTree = "<group>"; };
+		BBBE20962B21B1DE00509C4E /* KMPDFInsertWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPDFInsertWindowController.xib; sourceTree = "<group>"; };
 		BBBF687F2A3BF17F0058E14E /* KMFilePromiseProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMFilePromiseProvider.swift; sourceTree = "<group>"; };
 		BBBF68832A3C3AF10058E14E /* NSDocumentController+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDocumentController+KMExtension.swift"; sourceTree = "<group>"; };
 		BBC28F402B0EE7D600D73206 /* KMGroupFindTableRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMGroupFindTableRowView.swift; sourceTree = "<group>"; };
@@ -6412,6 +6420,8 @@
 				9F1F82D1292F6D510092C4B4 /* KMPDFInsertPreviewViewController.xib */,
 				9F1F82D8292F84D60092C4B4 /* KMHomeInsertActionViewController.swift */,
 				9F1F82D9292F84D60092C4B4 /* KMHomeInsertActionViewController.xib */,
+				BBBE20922B21B18900509C4E /* KMPDFInsertWindowController.swift */,
+				BBBE20962B21B1DE00509C4E /* KMPDFInsertWindowController.xib */,
 			);
 			path = Insert;
 			sourceTree = "<group>";
@@ -11252,6 +11262,7 @@
 				899700EB28F3E4D3009AF911 /* MainWindowController.xib in Resources */,
 				BB49ED01293F459500C82CA2 /* KMConvertPPTsWindowController.xib in Resources */,
 				ADD1B6AE2941E97F00C3FFF7 /* KMPrintWindowController.xib in Resources */,
+				BBBE20972B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */,
 				9F00CF542A38657400AC462E /* GoogleService-Info.plist in Resources */,
 				AD88108729A719E500178CA1 /* KMRegisterView.xib in Resources */,
 				BB1EC8012967B26700EC0BC3 /* KMPDFEditViewController.xib in Resources */,
@@ -11665,6 +11676,7 @@
 				9F853A062947137500DF644E /* newtab_h.pdf in Resources */,
 				ADAFD9F82AE68A8500F084BC /* KMCreatPDFView.xib in Resources */,
 				ADE86A7C2B0221E100414DFA /* KMSecurityWindowController.xib in Resources */,
+				BBBE20982B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */,
 				BB51074329A61B4100978662 /* ProgressSheet.xib in Resources */,
 				BBBE20902B2164CD00509C4E /* KMPDFEditWindowController.xib in Resources */,
 				BB1AEF3629F937A50048D179 /* PDF Master User Guide.pdf in Resources */,
@@ -12063,6 +12075,7 @@
 				8997010328F40710009AF911 /* KMBookMarkViewController.xib in Resources */,
 				9F00CCEF2A309E8E00AC462E /* KMEditImagePropertyViewController.xib in Resources */,
 				BBC4F9F02AEB58470098A1A8 /* KMAlertWindowController.xib in Resources */,
+				BBBE20992B21B1DF00509C4E /* KMPDFInsertWindowController.xib in Resources */,
 				ADBC2CF7299C7B3E006280C8 /* Print.xcassets in Resources */,
 				9F0CB48C29683DC400007028 /* KMPropertiesPanelPresetColorSubVC.xib in Resources */,
 				BBAC26AA2AFE138800563A08 /* KMToolbarItemPopViewController.xib in Resources */,
@@ -12406,6 +12419,7 @@
 				BBD54ED42A1CBD720012A230 /* NSView+KMExtension.swift in Sources */,
 				BB13314E2AD78DC0008F6791 /* KMPDFMergeSizeTabelViewCell.swift in Sources */,
 				9FAAA332290BD0A20046FFCE /* KMHistoryFileCollectionViewItem.swift in Sources */,
+				BBBE20932B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */,
 				BBC28F4A2B0F509B00D73206 /* KMAnimatedBorderlessWindow.swift in Sources */,
 				BB74DA7B2AC41DE9006EDFE7 /* NSString+KMExtension.swift in Sources */,
 				ADE86ADD2B0AF4B600414DFA /* KMCompareContentSettingWindowController.swift in Sources */,
@@ -14067,6 +14081,7 @@
 				BBF19E902B0B304C007154C8 /* KMStampCreaterWindowController.swift in Sources */,
 				BB35C4A02975362900D46EE2 /* KMRedactTopToolBar.swift in Sources */,
 				BB49ECEE293F3B0D00C82CA2 /* KMConvertOCRSettingItemView.swift in Sources */,
+				BBBE20942B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */,
 				89D2D309295A83B500BFF5FE /* KMEditPDFTextPropertyViewController.swift in Sources */,
 				9F0CB4DE2986554D00007028 /* KMDesignToken+HorizontalPadding.swift in Sources */,
 				9F1FE49A29406E4700E952CA /* NewTabButton.m in Sources */,
@@ -14550,6 +14565,7 @@
 				9F53D5552AD683A700CCF9D8 /* KMAnnotationPropertyBaseController.swift in Sources */,
 				BB4DD049299B294000E80DF6 /* KMCloudFileEmptyView.swift in Sources */,
 				BB3198182AC55E6D00107371 /* CPDFDocument+KMExtension.swift in Sources */,
+				BBBE20952B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */,
 				BB147037299DC0D200784A6A /* OIDRegistrationResponse.m in Sources */,
 				9F221ED929A9EC0900978A59 /* KMFillSignTextPanel.swift in Sources */,
 				9F0201742A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,

+ 29 - 14
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -1115,21 +1115,36 @@ extension KMHomeViewController {
     }
     
     func fastTool_Insert() {    // 插入
-//        let openPanel = NSOpenPanel()
-//        openPanel.prompt = "插入"
-//        openPanel.allowsMultipleSelection = false
-//        openPanel.allowedFileTypes = ["pdf"]
-//        
-//        openPanel.beginSheetModal(for: NSApp.mainWindow!) { result in
-//            if result == .OK {
-//                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
-//                    let insertWindowController: KMPDFInsertPageWindow = KMPDFInsertPageWindow.init(documentPath: openPanel.url!, toolType: .Insert)
-//                    insertWindowController.beginSheetModal(for: self.view.window!) { pdfDocument, password, pages, indexPage in
-//                        self.insertPageAction(pdfDocument, password, pages, indexPage)
+        let openPanel = NSOpenPanel()
+        openPanel.prompt = "插入"
+        openPanel.allowsMultipleSelection = false
+        openPanel.allowedFileTypes = ["pdf"]
+        
+        openPanel.beginSheetModal(for: NSApp.mainWindow!) { result in
+            if result == .OK {
+                //                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
+                //                    let insertWindowController: KMPDFInsertPageWindow = KMPDFInsertPageWindow.init(documentPath: openPanel.url!, toolType: .Insert)
+                //                    insertWindowController.beginSheetModal(for: self.view.window!) { pdfDocument, password, pages, indexPage in
+                //                        self.insertPageAction(pdfDocument, password, pages, indexPage)
+                //                    }
+                //                }
+                //            }
+                let windowC = KMPDFInsertWindowController(windowNibName: "KMPDFInsertWindowController")
+//                [com beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(PDFDocument *pdfDocument, NSString *password, NSMutableArray<PDFPage *> *pages, NSInteger indexPage) {
+//                    if (pdfDocument && indexPage >= 0) {
+//                        [pdfDocument insertWithInsertPages:pages insertPageIndex:indexPage];
+//                        [self savePDFDocument:pdfDocument password:password];
 //                    }
-//                }
-//            }
-//        }
+//                }];
+                windowC.callback = { [unowned self] idx, _ in
+                    if idx == 0 {
+                        self.km_endSheet()
+                        return
+                    }
+                }
+                self.km_beginSheet(windowC: windowC)
+            }
+        }
     }
     
     func fastTool_BreakUp() {   // 拆分

+ 469 - 0
PDF Office/PDF Master/Class/PDFTools/Insert/KMPDFInsertWindowController.swift

@@ -0,0 +1,469 @@
+//
+//  KMPDFInsertWindowController.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/12/7.
+//
+
+import Cocoa
+
+//enum KMPDFEditInsertType: Int {
+//    case management = 1
+//    case pageEdit
+//}
+
+class KMPDFInsertWindowController: NSWindowController {
+    /*
+     @interface KMPDFInsertPageWindow :NSWindowController<NSTextFieldDelegate,NSComboBoxDelegate>
+     - (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(PDFDocument *pdfDocument,NSString* password ,NSMutableArray<PDFPage *>* pages,NSInteger indexPage))handler;
+     */
+    @IBOutlet weak var progress: NSProgressIndicator!
+    @IBOutlet weak var pageCountLabel: NSTextField!
+    @IBOutlet weak var insertTypeLabel: NSTextField!
+    @IBOutlet weak var locationLabel: NSTextField!
+    @IBOutlet weak var pageRangeLabel: NSTextField!
+    
+    @IBOutlet weak var pageLabel: NSTextField!
+    @IBOutlet weak var pagesText: NSTextField!
+    @IBOutlet weak var outputFolderText: NSTextField!
+    @IBOutlet weak var blankButton: NSButton!
+    @IBOutlet weak var outputFolderButton: NSButton!
+    
+    @IBOutlet weak var locationFirstButton: NSButton!
+    @IBOutlet weak var locationLastButton: NSButton!
+    @IBOutlet weak var rangeButton: NSButton!
+    @IBOutlet weak var insertButton: NSButton!
+    @IBOutlet weak var cancelButton: NSButton!
+    
+    @IBOutlet weak var selectedPathButton: NSButton!
+    @IBOutlet weak var pageRangeBox: NSComboBox!
+    @IBOutlet weak var byPageStepper: NSStepper!
+    @IBOutlet weak var fromBackView: NSView!
+    @IBOutlet weak var insertBox: NSBox!
+    
+    @IBOutlet weak var whereInsertBox: NSBox!
+    @IBOutlet weak var insertLabel: NSTextField!
+    @IBOutlet weak var whereInsertLabel: NSTextField!
+    @IBOutlet weak var locationRangePopUpButton: NSPopUpButton!
+    
+    var insertLocation: Int = 0
+    var currentPage: Int = 0
+    
+    private var _pdfDocument: CPDFDocument?
+    private var _type: KMPDFEditInsertType = .management
+    
+    private var _insertPages: [CPDFPage] = []
+    private var _fromFilePath: URL?
+    private var _password: String?
+    private var _fromFilePassword: String?
+    
+    private var _insertPageIndex = 0
+    
+    var callback: KMCommonClickBlock?
+    
+    convenience init(document: CPDFDocument) {
+        self.init(windowNibName: "KMPDFInsertWindowController")
+        
+        self._type = .pageEdit
+        self._pdfDocument = document
+    }
+    
+    convenience init(fileURL documentPath: URL) {
+        self.init(windowNibName: "KMPDFInsertWindowController")
+        
+        self._type = .management
+        self.currentPage = 1
+        self._pdfDocument = CPDFDocument(url: documentPath)
+    }
+    
+    override func windowDidLoad() {
+        super.windowDidLoad()
+    
+        self._insertPages = []
+        self.fromBackView.wantsLayer = true
+        self.fromBackView.layer?.borderWidth = 0.8
+        self.fromBackView.layer?.cornerRadius = 2.0
+        var viewColor = NSColor.white
+        var viewborderColor = NSColor(red: 195.0/255.0, green: 195.0/255.0, blue: 195.0/255.0, alpha: 1)
+        var textColor = NSColor(red: 51.0/255.0, green: 51.0/255.0, blue: 51.0/255.0, alpha: 1)
+
+        if KMAppearance.isDarkMode() {
+            viewColor = NSColor(red: 101.0/255.0, green: 101.0/255.0, blue: 101.0/255.0, alpha: 1)
+            viewborderColor = .clear
+            textColor = .white
+        }
+        
+        self.fromBackView.layer?.backgroundColor = viewColor.cgColor
+        self.fromBackView.layer?.borderColor = viewborderColor.cgColor
+        self.outputFolderText.textColor = textColor
+        self.selectedPathButton.title = KMLocalizedString("Choose...", nil)
+        self.insertLabel.stringValue = KMLocalizedString("Insert",nil)
+        
+        self.whereInsertLabel.stringValue = KMLocalizedString("Where to insert?",nil)
+        self.pageRangeLabel.stringValue = KMLocalizedString("Page Range:", nil)
+        self.pageLabel.stringValue = KMLocalizedString("Page", nil)
+        
+        self.selectedPathButton.isEnabled = false
+        self.progress.isHidden = true
+        
+        self.pageRangeBox.isEditable = false
+        self.outputFolderText.isEditable = false
+        self.pagesText.isEditable = false
+        self.byPageStepper.isEnabled = false
+        self.pageRangeLabel.isHidden = true
+        self.pageRangeBox.isHidden = true
+        
+        self.blankButton.title = KMLocalizedString("Blank Page", nil)
+        self.locationFirstButton.title = KMLocalizedString("First", nil)
+        self.locationLastButton.title = KMLocalizedString("Last", nil)
+        self.outputFolderButton.title = KMLocalizedString("From PDF", nil)
+        
+        self.cancelButton.title = KMLocalizedString("Cancel", nil)
+        self.insertButton.title = KMLocalizedString("Insert", nil)
+        
+        self.pagesText.formatter = TextFieldFormatter()
+        self.pagesText.delegate = self
+        
+        self.pageRangeBox.addItem(withObjectValue: KMLocalizedString("All Pages", nil))
+        self.pageRangeBox.addItem(withObjectValue: KMLocalizedString("Odd Pages Only", nil))
+        self.pageRangeBox.addItem(withObjectValue: KMLocalizedString("Even Pages Only", nil))
+        self.pageRangeBox.addItem(withObjectValue: KMLocalizedString("e.g. 1,3-5,10", nil))
+        (self.pageRangeBox.cell as? NSComboBoxCell)?.placeholderString = KMLocalizedString("e.g. 1,3-5,10", nil)
+        self.pageRangeBox.selectItem(at: 0)
+        
+        let menu = NSMenu()
+        _ = menu.addItem(title: KMLocalizedString("After", nil), action: #selector(after_Action), target: self)
+        _ = menu.addItem(title: KMLocalizedString("Before", nil), action: #selector(before_Action), target: self)
+        self.locationRangePopUpButton.menu = menu
+        
+        self.outputFolderText.placeholderString = KMLocalizedString("Select a File", nil)
+        
+        self.pageRangeBox.isEnabled = false
+        self.locationRangePopUpButton.isEnabled = false
+        
+        if let data = self._pdfDocument?.isLocked, data {
+//            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                PasswordWindowController *passwordVC = [[PasswordWindowController alloc] initWithWindowNibName:@"PasswordWindowController"];
+//                passwordVC.fileURL = [self.pdfDocument documentURL];
+                
+//                [passwordVC beginSheetModalForWindow:self.window completionHandler:^(NSString *password) {
+//                    if (password) {
+//                        [_pdfDocument unlockWithPassword:password];
+//                        self.password = password;
+//
+//                        _pageCountLabel.stringValue = [NSString stringWithFormat:@"/%ld",_pdfDocument.pageCount];
+//                        _byPageStepper.minValue = 1.0;
+//                        _byPageStepper.maxValue = _pdfDocument.pageCount;
+//
+//                    }
+//                }];
+//                [passwordVC release];
+//            });
+        } else {
+            self.byPageStepper.minValue = 1.0
+            self.byPageStepper.maxValue = Double(self._pdfDocument?.pageCount ?? 0)
+            self.pageCountLabel.stringValue = String(format: "/%ld", self._pdfDocument?.pageCount ?? 0)
+        }
+        
+        if (self.insertLocation == 2) {
+            self.locationLastButton.state = .on
+        } else if (self.insertLocation == 3) {
+            self.rangeButton.state = .on
+            self.locationRangePopUpButton.isEnabled = true
+            self.pagesText.isEditable = true
+            self.byPageStepper.isEnabled = true
+        } else {
+            self.locationFirstButton.state = .on
+        }
+        
+        self.pagesText.stringValue = String(format: "%ld", self.currentPage)
+        self.byPageStepper.integerValue = Int(self.pagesText.stringValue) ?? 0
+    }
+    
+    /*
+     #pragma mark Private methor
+     - (void)viewFileAtFinder:(NSString *)filePath
+     {
+         NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
+         NSURL *url = [NSURL fileURLWithPath:filePath];
+         [workspace activateFileViewerSelectingURLs:[NSArray arrayWithObject:url]];
+     }
+
+     #pragma mark Show Methods
+     - (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
+         if (contextInfo != NULL) {
+             void (^handler)(PDFDocument *pdfDocument ,NSString* password,NSMutableArray<PDFPage *>* pages,NSInteger indexPage) = (void(^)(PDFDocument *pdfDocument,NSString* password,NSMutableArray<PDFPage *>* pages,NSInteger indexPage))contextInfo;
+             handler(self.pdfDocument,self.password,self.insertPages,self.insertPageIndex);
+             Block_release(handler);
+         }
+     }
+
+     - (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(PDFDocument *pdfDocument,NSString* password ,NSMutableArray<PDFPage *>* pages,NSInteger indexPage))handler;
+     {
+         [self retain]; // make sure we stay around long enough
+         
+         [NSApp beginSheet:[self window]
+            modalForWindow:window
+             modalDelegate:self
+            didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
+               contextInfo:handler ? Block_copy(handler) : NULL];
+     }
+
+     
+     - (IBAction)buttonItemClicked_Insert:(id)sender
+     {
+         if ([self.pdfDocument isLocked]) {
+             [self.pdfDocument unlockWithPassword:_password];
+         }
+         
+         PDFDocument *fromDocument = [[PDFDocument alloc] initWithURL:_fromFilePath];
+         if ([fromDocument isLocked]) {
+             [fromDocument unlockWithPassword:_fromFilePassword];
+         }
+         
+         [_progress setHidden:NO];
+         [_cancelButton setEnabled:NO];
+         [_insertButton setEnabled:NO];
+         [_progress startAnimation:nil];
+         
+         NSMutableArray *pages = [NSMutableArray array];
+         
+         if (_blankButton.state == 1) {
+             PDFPage *page = [[PDFPage alloc] init];
+             [page setBounds:NSMakeRect(0, 0, 588, 832) forBox:kPDFDisplayBoxCropBox];
+             [pages addObject:page];
+             
+             [page release];
+         } else {
+             if ([_outputFolderText.stringValue isEqualToString:@""] || _outputFolderText.stringValue.length < 1) {
+                 NSAlert *alert = [[NSAlert alloc] init];
+                 [alert setAlertStyle:NSCriticalAlertStyle];
+                 [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Select a File", nil)]];
+                 [alert runModal];
+                 [alert release];
+                 
+                 [_progress setHidden:YES];
+                 [_cancelButton setEnabled:YES];
+                 [_insertButton setEnabled:YES];
+                 [_progress stopAnimation:nil];
+                 return;
+             }
+             
+             KMFileAttribute *fileAttribute = [[KMFileAttribute alloc] init];
+             fileAttribute.filePath =  _outputFolderText.stringValue;
+             
+             if ((0 == [_pageRangeBox indexOfSelectedItem])) {
+                 fileAttribute.bAllPage = YES;
+             } else if(1 == [_pageRangeBox indexOfSelectedItem]){
+                 fileAttribute.bAllPage = NO;
+                 PDFDocument *tDocument = [[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:fileAttribute.filePath]];
+                 NSString *tPagesString = @"";
+                 for (NSUInteger i = 0; i < tDocument.pageCount; i++) {
+                     if (i%2 == 0) {
+                         if (tPagesString.length == 0) {
+                             tPagesString = [tPagesString stringByAppendingString:[NSString stringWithFormat:@"%ld",i +1]];
+                         }else{
+                             tPagesString = [tPagesString stringByAppendingString:[NSString stringWithFormat:@",%ld",i +1]];
+                         }
+                         
+                     }
+                 }
+                 fileAttribute.pagesString = tPagesString;
+                 [tDocument release];
+             } else if (2 == [_pageRangeBox indexOfSelectedItem]){
+                 fileAttribute.bAllPage = NO;
+                 PDFDocument *tDocument = [[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:fileAttribute.filePath]];
+                 NSString *tPagesString = @"";
+                 for (NSUInteger i = 0; i < tDocument.pageCount; i++) {
+                     if (i%2) {
+                         if (tPagesString.length == 0) {
+                             tPagesString = [tPagesString stringByAppendingString:[NSString stringWithFormat:@"%ld",i +1]];
+                         }else{
+                             tPagesString = [tPagesString stringByAppendingString:[NSString stringWithFormat:@",%ld",i +1]];
+                         }
+                     }
+                 }
+                 fileAttribute.pagesString = tPagesString;
+                 [tDocument release];
+             } else {
+                 fileAttribute.bAllPage = NO;
+                 fileAttribute.pagesString = _pageRangeBox.stringValue;
+             }
+             if (!fileAttribute.selectPages) {
+                 NSAlert *alert = [[NSAlert alloc] init];
+                 [alert setAlertStyle:NSCriticalAlertStyle];
+                 [alert setMessageText:[NSString stringWithFormat:@"%@ %@",[fileAttribute.filePath lastPathComponent],NSLocalizedString(@"Invalid page range or the page number is out of range. Please try again.", nil)]];
+                 [alert runModal];
+                 [alert release];
+                 
+                 [_progress setHidden:YES];
+                 [_cancelButton setEnabled:YES];
+                 [_insertButton setEnabled:YES];
+                 [_progress stopAnimation:nil];
+                 
+                 [fileAttribute release];
+                 return;
+             } else {
+                 PDFDocument *insertPDF = [[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:_outputFolderText.stringValue]];
+                 
+                 for(NSNumber *number in fileAttribute.selectPages){
+                     PDFPage * page = [[insertPDF pageAtIndex:([number intValue] -1)] copy];
+                     [pages addObject:page];
+                 }
+                 [fileAttribute release];
+                 [insertPDF release];
+             }
+         }
+         
+         NSInteger index = 0;
+         if (_locationFirstButton.state == 1) {
+             index = 0;
+             
+         } else if (_locationLastButton.state == 1) {
+             index =  _pdfDocument.pageCount;
+         } else {
+             index = _pagesText.stringValue.integerValue;
+             if ((1 == [_locationRangePopUpButton indexOfSelectedItem])) {
+                 index = index - 1;
+             }
+         }
+         
+         [self.insertPages addObjectsFromArray:pages];
+         self.insertPageIndex = index;
+         
+         [_progress setHidden:YES];
+         [_cancelButton setEnabled:YES];
+         [_insertButton setEnabled:YES];
+         [_progress stopAnimation:nil];
+         
+         [NSApp endSheet:[self window] returnCode:[sender tag]];
+         [[self window] orderOut:self];
+         [self release];
+     }
+     
+     */
+    
+    @IBAction func byPageStepperAction(_ sender: AnyObject?) {
+        self.pagesText.stringValue = "\(self.byPageStepper.integerValue)"
+    }
+    
+    @IBAction func buttonItemClicked_InsertType(_ sender: AnyObject?) {
+        if self.blankButton.isEqual(to: sender) {
+            self.selectedPathButton.isEnabled = false
+            self.pageRangeBox.isEnabled = false
+            self.pageRangeLabel.isHidden = true
+            self.pageRangeBox.isHidden = true
+        } else {
+            self.pageRangeBox.isEnabled = true
+            self.selectedPathButton.isEnabled = true
+            self.pageRangeLabel.isHidden = false
+            self.pageRangeBox.isHidden = false
+        }
+    }
+    
+    @IBAction func buttonItemClicked_Location(_ sender: AnyObject?) {
+        if self.rangeButton.isEqual(to: sender) {
+            self.pagesText.isEditable = true
+            self.locationRangePopUpButton.isEnabled = true
+            self.byPageStepper.isEnabled = true
+        } else {
+            self.pagesText.isEditable = false
+            self.locationRangePopUpButton.isEnabled = false
+            self.byPageStepper.isEnabled = false
+        }
+    }
+    
+    @IBAction func buttonItemClicked_Cancel(_ sender: AnyObject?) {
+        self._pdfDocument = nil
+
+        guard let block = self.callback else {
+            return
+        }
+        block(0)
+    }
+    
+    @IBAction func buttonItemClicked_OutputFolder(_ sender: AnyObject?) {
+        let openPanel = NSOpenPanel()
+        openPanel.allowedFileTypes = ["pdf"]
+        openPanel.beginSheetModal(for: self.window!) { result in
+            if (result == .OK) {
+                for fileURL in openPanel.urls {
+                    guard let pdfDoc = CPDFDocument(url: fileURL) else {
+                        continue
+                    }
+                    
+                    if (pdfDoc.isLocked) {
+//                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                            PasswordWindowController *com = [[PasswordWindowController alloc] initWithWindowNibName:@"PasswordWindowController"];
+//                            com.fileURL = fileURL;
+//
+//                            [com beginSheetModalForWindow:self.window completionHandler:^(NSString *password) {
+//                                if (password) {
+//                                    self.password = password;
+//                                    self.fromFilePath = fileURL;
+//                                    _outputFolderText.stringValue = [_fromFilePath path];
+//
+//                                    [_pageRangeBox selectItemAtIndex:0];
+//                                    [self.window makeFirstResponder:self];
+//                                    [_pageRangeBox setEditable:NO];
+//                                    _pagesText.stringValue = [NSString stringWithFormat:@"%d",1];
+//                                    [_insertButton setEnabled:YES];
+//
+//                                }
+//                            }];
+//                            [com release];
+//                        });
+                    } else {
+                        self._fromFilePath = fileURL
+                        self.outputFolderText.stringValue = self._fromFilePath?.path ?? ""
+                        
+                        self.pageRangeBox.selectItem(at: 0)
+                        self.window?.makeFirstResponder(self)
+                        self.pageRangeBox.isEditable = false
+                        self.pagesText.stringValue = "1"
+                        self.insertButton.isEnabled = true
+                    }
+                }
+            }
+        }
+    }
+   
+    @IBAction func after_Action(_ sender: AnyObject?) {
+        
+    }
+    
+    @IBAction func before_Action(_ sender: AnyObject?) {
+        
+    }
+    
+    @IBAction func comboxClicked_PageRange(_ sender: AnyObject?) {
+        if (0 == self.pageRangeBox.indexOfSelectedItem ||
+            1 == self.pageRangeBox.indexOfSelectedItem ||
+            2 == self.pageRangeBox.indexOfSelectedItem) {
+            self.window?.makeFirstResponder(self)
+            self.pageRangeBox.isEditable = false
+        }else{
+            self.pageRangeBox.stringValue = self.pageRangeBox.stringValue
+            self.pageRangeBox.isEditable = true
+            self.window?.makeFirstResponder(self.pageRangeBox)
+        }
+    }
+
+}
+
+extension KMPDFInsertWindowController: NSTextFieldDelegate {
+    func controlTextDidChange(_ obj: Notification) {
+        if self.pagesText.isEqual(to: obj.object) {
+            let pageNum = Int(self.pagesText.stringValue) ?? 0
+            if (pageNum <= 0) {
+                self.pagesText.stringValue = "1"
+                self.byPageStepper.integerValue = 1
+            } else if (pageNum > Int(self.byPageStepper.maxValue)) {
+                self.pagesText.stringValue = "\(self.byPageStepper.maxValue)"
+                self.byPageStepper.integerValue = Int(self.byPageStepper.maxValue)
+            } else {
+                self.byPageStepper.integerValue = pageNum
+            }
+        }
+    }
+}

+ 348 - 0
PDF Office/PDF Master/Class/PDFTools/Insert/KMPDFInsertWindowController.xib

@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMPDFInsertPageWindow" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="blankButton" destination="HhL-Ce-Cfj" id="RXI-qt-wqw"/>
+                <outlet property="byPageStepper" destination="GiJ-pL-a9i" id="vlt-2C-0le"/>
+                <outlet property="cancelButton" destination="dDZ-9H-ij1" id="Hgo-Ie-nOh"/>
+                <outlet property="fromBackView" destination="pzu-y7-QrB" id="oka-BH-4q9"/>
+                <outlet property="insertBox" destination="Agm-9q-9Ve" id="JwU-iy-XBM"/>
+                <outlet property="insertButton" destination="Ph0-Hk-l6a" id="3Ft-pN-UcQ"/>
+                <outlet property="insertLabel" destination="rNB-Ox-MsP" id="Nl4-n5-nyH"/>
+                <outlet property="locationFirstButton" destination="KpR-Eb-k9K" id="Djb-Uy-qEp"/>
+                <outlet property="locationLastButton" destination="ylR-0q-ZfJ" id="uc0-qr-LOO"/>
+                <outlet property="locationRangePopUpButton" destination="c6s-qr-3c6" id="Vu8-k8-dgi"/>
+                <outlet property="outputFolderButton" destination="psf-pr-GPk" id="BQu-QD-S99"/>
+                <outlet property="outputFolderText" destination="a0n-Zy-KF1" id="PWh-q5-gBg"/>
+                <outlet property="pageCountLabel" destination="cT4-Ne-K12" id="cpQ-ZX-cUA"/>
+                <outlet property="pageLabel" destination="MXi-lH-akQ" id="WLs-pb-91a"/>
+                <outlet property="pageRangeBox" destination="kZ3-Pf-2m2" id="Vhp-i1-eRR"/>
+                <outlet property="pageRangeLabel" destination="CJO-Fq-fd0" id="5sD-5O-tZZ"/>
+                <outlet property="pagesText" destination="GKk-5I-uce" id="bQ7-sT-IyF"/>
+                <outlet property="progress" destination="7YG-Hl-P0a" id="YRP-Hu-iZU"/>
+                <outlet property="rangeButton" destination="NBs-P3-OO5" id="UN9-q9-nKf"/>
+                <outlet property="selectedPathButton" destination="kh2-5e-PCC" id="BWb-bF-bhA"/>
+                <outlet property="whereInsertBox" destination="DRX-og-Eei" id="JpY-gL-h7x"/>
+                <outlet property="whereInsertLabel" destination="a1I-lj-cSX" id="boF-Un-agw"/>
+                <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"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="512" height="372"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <value key="minSize" type="size" width="400" height="380"/>
+            <value key="maxSize" type="size" width="400" height="381"/>
+            <view key="contentView" wantsLayer="YES" misplaced="YES" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="512" height="372"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dDZ-9H-ij1">
+                        <rect key="frame" x="351" y="13" width="76" height="32"/>
+                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="cy2-f5-Idk">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="buttonItemClicked_Cancel:" target="-2" id="d7E-g9-bbi"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ph0-Hk-l6a">
+                        <rect key="frame" x="420" y="13" width="69" height="32"/>
+                        <buttonCell key="cell" type="push" title="Insert" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="DYn-oP-J0z">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="buttonItemClicked_Insert:" target="-2" id="LI8-Gx-UY9"/>
+                        </connections>
+                    </button>
+                    <progressIndicator wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="7YG-Hl-P0a">
+                        <rect key="frame" x="248" y="183" width="16" height="16"/>
+                    </progressIndicator>
+                    <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="DRX-og-Eei">
+                        <rect key="frame" x="37" y="57" width="438" height="131"/>
+                        <view key="contentView" id="IYV-VX-8fc">
+                            <rect key="frame" x="3" y="3" width="432" height="125"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <button translatesAutoresizingMaskIntoConstraints="NO" id="KpR-Eb-k9K">
+                                    <rect key="frame" x="14" y="95" width="53" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="18" id="Rmz-bL-TX1"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="radio" title="First" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="qpx-eB-Smq">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_Location:" target="-2" id="5JD-He-87y"/>
+                                    </connections>
+                                </button>
+                                <button translatesAutoresizingMaskIntoConstraints="NO" id="ylR-0q-ZfJ">
+                                    <rect key="frame" x="14" y="67" width="52" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="18" id="Wi1-ef-DbJ"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="radio" title="Last" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="TpB-dB-lEP">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_Location:" target="-2" id="BUT-V4-a19"/>
+                                    </connections>
+                                </button>
+                                <button translatesAutoresizingMaskIntoConstraints="NO" id="NBs-P3-OO5">
+                                    <rect key="frame" x="14" y="42" width="18" height="18"/>
+                                    <buttonCell key="cell" type="radio" title="Page" bezelStyle="regularSquare" imagePosition="only" alignment="left" inset="2" id="LHF-jZ-0UI">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_Location:" target="-2" id="8Mq-uT-GKr"/>
+                                    </connections>
+                                </button>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MXi-lH-akQ">
+                                    <rect key="frame" x="33" y="43" width="35" height="16"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Page" id="2qb-I6-XEj">
+                                        <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>
+                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GKk-5I-uce">
+                                    <rect key="frame" x="75" y="41" width="108" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="108" id="3wU-S5-X6N"/>
+                                        <constraint firstAttribute="height" constant="20" id="cS4-SN-B95"/>
+                                    </constraints>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="MEc-8D-RXi">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GiJ-pL-a9i">
+                                    <rect key="frame" x="185" y="37" width="19" height="28"/>
+                                    <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="6sM-Bz-zDC"/>
+                                    <connections>
+                                        <action selector="byPageStepperAction:" target="-2" id="XtZ-5U-mSF"/>
+                                    </connections>
+                                </stepper>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cT4-Ne-K12">
+                                    <rect key="frame" x="207" y="43" width="24" height="16"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/25" id="r35-hv-0er">
+                                        <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>
+                                <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="c6s-qr-3c6">
+                                    <rect key="frame" x="32" y="6" width="312" height="25"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="20" id="R9S-HU-5dj"/>
+                                        <constraint firstAttribute="width" constant="305" id="vyc-vQ-nSR"/>
+                                    </constraints>
+                                    <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="g8o-cO-Sqe" id="3sD-0j-JXt">
+                                        <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="menu"/>
+                                        <menu key="menu" id="3Ws-lC-kKX">
+                                            <items>
+                                                <menuItem title="Item 1" state="on" id="g8o-cO-Sqe"/>
+                                                <menuItem title="Item 2" id="TuX-S7-Ht9"/>
+                                                <menuItem title="Item 3" id="jV3-Aa-2G3"/>
+                                            </items>
+                                        </menu>
+                                    </popUpButtonCell>
+                                </popUpButton>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="MXi-lH-akQ" firstAttribute="leading" secondItem="NBs-P3-OO5" secondAttribute="trailing" constant="5" id="4zR-G9-oIz"/>
+                                <constraint firstItem="cT4-Ne-K12" firstAttribute="leading" secondItem="GiJ-pL-a9i" secondAttribute="trailing" constant="8" id="9bj-BF-6f9"/>
+                                <constraint firstItem="NBs-P3-OO5" firstAttribute="leading" secondItem="KpR-Eb-k9K" secondAttribute="leading" id="CdW-J3-ms1"/>
+                                <constraint firstItem="GiJ-pL-a9i" firstAttribute="centerY" secondItem="NBs-P3-OO5" secondAttribute="centerY" id="E4s-dM-g9R"/>
+                                <constraint firstItem="NBs-P3-OO5" firstAttribute="top" secondItem="ylR-0q-ZfJ" secondAttribute="bottom" constant="10" id="EO7-xp-97s"/>
+                                <constraint firstItem="GKk-5I-uce" firstAttribute="leading" secondItem="MXi-lH-akQ" secondAttribute="trailing" constant="9" id="HlY-LX-SCC"/>
+                                <constraint firstItem="ylR-0q-ZfJ" firstAttribute="leading" secondItem="KpR-Eb-k9K" secondAttribute="leading" id="PA9-BX-tra"/>
+                                <constraint firstItem="GKk-5I-uce" firstAttribute="centerY" secondItem="NBs-P3-OO5" secondAttribute="centerY" id="Sdd-0i-SWu"/>
+                                <constraint firstItem="c6s-qr-3c6" firstAttribute="top" secondItem="GKk-5I-uce" secondAttribute="bottom" constant="11" id="Vzh-uu-VNi"/>
+                                <constraint firstItem="KpR-Eb-k9K" firstAttribute="leading" secondItem="IYV-VX-8fc" secondAttribute="leading" constant="16" id="Y5Z-m3-v3Q"/>
+                                <constraint firstItem="KpR-Eb-k9K" firstAttribute="top" secondItem="IYV-VX-8fc" secondAttribute="top" constant="11" id="b9f-OZ-lex"/>
+                                <constraint firstAttribute="bottom" secondItem="c6s-qr-3c6" secondAttribute="bottom" constant="10" id="dmu-A8-uHM"/>
+                                <constraint firstItem="c6s-qr-3c6" firstAttribute="leading" secondItem="MXi-lH-akQ" secondAttribute="leading" id="k3f-4A-wg6"/>
+                                <constraint firstItem="GiJ-pL-a9i" firstAttribute="leading" secondItem="GKk-5I-uce" secondAttribute="trailing" constant="5" id="lSg-BG-vq3"/>
+                                <constraint firstItem="cT4-Ne-K12" firstAttribute="centerY" secondItem="NBs-P3-OO5" secondAttribute="centerY" id="nKi-0u-VT1"/>
+                                <constraint firstItem="ylR-0q-ZfJ" firstAttribute="top" secondItem="KpR-Eb-k9K" secondAttribute="bottom" constant="10" id="sDG-nQ-Jch"/>
+                                <constraint firstItem="MXi-lH-akQ" firstAttribute="centerY" secondItem="NBs-P3-OO5" secondAttribute="centerY" id="utB-o9-hGF"/>
+                            </constraints>
+                        </view>
+                    </box>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="a1I-lj-cSX">
+                        <rect key="frame" x="54" y="186" width="37" height="18"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="18" id="XaE-8z-XoX"/>
+                        </constraints>
+                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="0Z0-Ao-rdX">
+                            <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 title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Agm-9q-9Ve">
+                        <rect key="frame" x="37" y="220" width="438" height="127"/>
+                        <view key="contentView" id="qLl-7m-Uzt">
+                            <rect key="frame" x="3" y="3" width="432" height="121"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kZ3-Pf-2m2">
+                                    <rect key="frame" x="94" y="6" width="325" height="26"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="20" id="xXL-oN-cRu"/>
+                                    </constraints>
+                                    <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="xdI-dS-NJp">
+                                        <font key="font" metaFont="system"/>
+                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </comboBoxCell>
+                                    <connections>
+                                        <action selector="comboxClicked_PageRange:" target="-2" id="rh6-ii-wC7"/>
+                                    </connections>
+                                </comboBox>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CJO-Fq-fd0">
+                                    <rect key="frame" x="14" y="12" width="77" height="16"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Page Range" id="Cd6-SO-y3k">
+                                        <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>
+                                <button translatesAutoresizingMaskIntoConstraints="NO" id="HhL-Ce-Cfj">
+                                    <rect key="frame" x="14" y="92" width="93" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="18" id="Zmp-pI-47B"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="radio" title="Blank page" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="0J1-3r-GXT">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_InsertType:" target="-2" id="j9n-sE-OkR"/>
+                                    </connections>
+                                </button>
+                                <button translatesAutoresizingMaskIntoConstraints="NO" id="psf-pr-GPk">
+                                    <rect key="frame" x="14" y="64" width="86" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="18" id="BLo-a1-h4H"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="radio" title="From PDF" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Roj-li-6Yw">
+                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_InsertType:" target="-2" id="yPz-Sm-fRt"/>
+                                    </connections>
+                                </button>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="pzu-y7-QrB">
+                                    <rect key="frame" x="37" y="40" width="307" height="22"/>
+                                    <subviews>
+                                        <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="a0n-Zy-KF1">
+                                            <rect key="frame" x="5" y="0.0" width="302" height="20"/>
+                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" drawsBackground="YES" id="E2p-mZ-U4Z">
+                                                <font key="font" metaFont="system"/>
+                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" red="0.11764705882352941" green="0.11764705882352941" blue="0.11764705882352941" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                            </textFieldCell>
+                                        </textField>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstAttribute="bottom" secondItem="a0n-Zy-KF1" secondAttribute="bottom" id="4ip-sC-dLN"/>
+                                        <constraint firstAttribute="height" constant="22" id="8wZ-Fg-DiP"/>
+                                        <constraint firstItem="a0n-Zy-KF1" firstAttribute="leading" secondItem="pzu-y7-QrB" secondAttribute="leading" constant="5" id="KWR-T9-tP9"/>
+                                        <constraint firstAttribute="trailing" secondItem="a0n-Zy-KF1" secondAttribute="trailing" id="N5P-hr-khS"/>
+                                        <constraint firstItem="a0n-Zy-KF1" firstAttribute="top" secondItem="pzu-y7-QrB" secondAttribute="top" constant="2" id="Q8r-fX-0cB"/>
+                                    </constraints>
+                                </customView>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kh2-5e-PCC">
+                                    <rect key="frame" x="348" y="34" width="75" height="32"/>
+                                    <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="08p-jF-QB4">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="buttonItemClicked_OutputFolder:" target="-2" id="2Gr-RX-QBx"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="trailing" secondItem="kh2-5e-PCC" secondAttribute="trailing" constant="16" id="4jR-Ej-WoS"/>
+                                <constraint firstItem="kZ3-Pf-2m2" firstAttribute="top" secondItem="pzu-y7-QrB" secondAttribute="bottom" constant="10" id="KST-Gd-bmk"/>
+                                <constraint firstItem="psf-pr-GPk" firstAttribute="leading" secondItem="HhL-Ce-Cfj" secondAttribute="leading" id="KlN-ad-TdL"/>
+                                <constraint firstItem="CJO-Fq-fd0" firstAttribute="leading" secondItem="psf-pr-GPk" secondAttribute="leading" id="Sl9-na-stT"/>
+                                <constraint firstItem="psf-pr-GPk" firstAttribute="top" secondItem="HhL-Ce-Cfj" secondAttribute="bottom" constant="10" id="WcT-Fk-C1e"/>
+                                <constraint firstAttribute="bottom" secondItem="kZ3-Pf-2m2" secondAttribute="bottom" constant="10" id="Z9r-AI-XRv"/>
+                                <constraint firstItem="kh2-5e-PCC" firstAttribute="leading" secondItem="pzu-y7-QrB" secondAttribute="trailing" constant="11" id="ct9-HK-JDH"/>
+                                <constraint firstItem="pzu-y7-QrB" firstAttribute="leading" secondItem="qLl-7m-Uzt" secondAttribute="leading" constant="37" id="e30-up-Yp9"/>
+                                <constraint firstItem="kh2-5e-PCC" firstAttribute="centerY" secondItem="pzu-y7-QrB" secondAttribute="centerY" id="hnN-jr-CwO"/>
+                                <constraint firstItem="kZ3-Pf-2m2" firstAttribute="centerY" secondItem="CJO-Fq-fd0" secondAttribute="centerY" id="jaa-am-Qla"/>
+                                <constraint firstItem="HhL-Ce-Cfj" firstAttribute="leading" secondItem="qLl-7m-Uzt" secondAttribute="leading" constant="16" id="lpd-WU-EPM"/>
+                                <constraint firstItem="pzu-y7-QrB" firstAttribute="top" secondItem="psf-pr-GPk" secondAttribute="bottom" constant="3" id="qOV-7o-OWc"/>
+                                <constraint firstItem="kZ3-Pf-2m2" firstAttribute="leading" secondItem="CJO-Fq-fd0" secondAttribute="trailing" constant="5" id="sSn-pu-ewT"/>
+                                <constraint firstItem="HhL-Ce-Cfj" firstAttribute="top" secondItem="qLl-7m-Uzt" secondAttribute="top" constant="10" id="uyO-EE-JAW"/>
+                                <constraint firstAttribute="trailing" secondItem="kZ3-Pf-2m2" secondAttribute="trailing" constant="16" id="wdU-IH-meg"/>
+                            </constraints>
+                        </view>
+                    </box>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rNB-Ox-MsP">
+                        <rect key="frame" x="54" y="345" width="37" height="18"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="18" id="0Cf-bn-5m6"/>
+                        </constraints>
+                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="an7-vZ-veF">
+                            <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>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="Ph0-Hk-l6a" firstAttribute="centerY" secondItem="dDZ-9H-ij1" secondAttribute="centerY" id="5Uf-QQ-wjI"/>
+                    <constraint firstItem="a1I-lj-cSX" firstAttribute="top" secondItem="Agm-9q-9Ve" secondAttribute="bottom" constant="20" id="6sV-8F-j2F"/>
+                    <constraint firstItem="7YG-Hl-P0a" firstAttribute="centerX" secondItem="se5-gp-TjO" secondAttribute="centerX" id="7qL-QB-JEk"/>
+                    <constraint firstAttribute="trailing" secondItem="Agm-9q-9Ve" secondAttribute="trailing" constant="40" id="9GF-CX-KKa"/>
+                    <constraint firstItem="Agm-9q-9Ve" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="40" id="Drm-ai-hSt"/>
+                    <constraint firstItem="dDZ-9H-ij1" firstAttribute="top" secondItem="DRX-og-Eei" secondAttribute="bottom" constant="21" id="Ig8-VQ-rOm"/>
+                    <constraint firstItem="7YG-Hl-P0a" firstAttribute="centerY" secondItem="se5-gp-TjO" secondAttribute="centerY" id="Iwp-rm-PfU"/>
+                    <constraint firstItem="a1I-lj-cSX" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="56" id="JD7-Zl-AQ3"/>
+                    <constraint firstItem="Agm-9q-9Ve" firstAttribute="top" secondItem="rNB-Ox-MsP" secondAttribute="bottom" id="M7I-Ng-cyf"/>
+                    <constraint firstAttribute="trailing" secondItem="DRX-og-Eei" secondAttribute="trailing" constant="40" id="MjA-79-y9Y"/>
+                    <constraint firstAttribute="trailing" secondItem="Ph0-Hk-l6a" secondAttribute="trailing" constant="30" id="OAH-1F-aUn"/>
+                    <constraint firstItem="rNB-Ox-MsP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="56" id="V02-qs-GIJ"/>
+                    <constraint firstAttribute="bottom" secondItem="Ph0-Hk-l6a" secondAttribute="bottom" constant="20" id="jcG-il-ohy"/>
+                    <constraint firstItem="Ph0-Hk-l6a" firstAttribute="leading" secondItem="dDZ-9H-ij1" secondAttribute="trailing" constant="7" id="p4C-tq-kz2"/>
+                    <constraint firstItem="DRX-og-Eei" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="40" id="xWG-CH-4Xx"/>
+                    <constraint firstItem="DRX-og-Eei" firstAttribute="top" secondItem="a1I-lj-cSX" secondAttribute="bottom" id="xwT-wK-BUt"/>
+                    <constraint firstItem="rNB-Ox-MsP" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="18" id="yZK-RY-9GA"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="70" y="138"/>
+        </window>
+    </objects>
+</document>