Selaa lähdekoodia

[系统菜单] - 新建 - 截屏 - 子菜单创建PDF

liujiajie 1 vuosi sitten
vanhempi
commit
b1fba35f27

+ 75 - 4
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -1173,7 +1173,7 @@ extension KMBrowserWindowController: KMSystemFileMenuProtocol {
         }
         
         if let data = data {
-            let documentC = NSDocumentController.shared
+            _ = NSDocumentController.shared
 
             document = CPDFDocument(data: data)
             
@@ -1293,15 +1293,79 @@ extension KMBrowserWindowController: KMSystemFileMenuProtocol {
     
     @IBAction func screenShot_SelectArea(_ sender: Any?) {
         KMPrint("screenShot_SelectArea")
+        KMScreenShotHandler.beginScreenshot_SelectRectWithCompleteHandler { ima in
+            if let image = ima {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                    let savePath = (NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last ?? "") + "/" + Bundle.main.bundleIdentifier! + "/screenShot.pdf"
+                    let newDocument = CPDFDocument()
+                    _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: newDocument?.pageCount ?? 0)
+                    let writeSuccess = newDocument?.write(to: URL(fileURLWithPath: savePath))
+                    if writeSuccess ?? false {
+                        self.savePdf(savePath)
+//                        try? FileManager.default.removeItem(atPath: savePath)
+                    } else {
+                        
+                    }
+                }
+            }
+        }
     }
     @IBAction func screenShot_Window(_ sender: Any?) {
         KMPrint("screenShot_Window")
+        KMScreenShotHandler.beginScreenShot_SelectWindowCompleteHandler { ima in
+            if let image = ima {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                    let savePath = (NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last ?? "") + "/" + Bundle.main.bundleIdentifier! + "/screenShot.pdf"
+                    let newDocument = CPDFDocument()
+                    _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: newDocument?.pageCount ?? 0)
+                    let writeSuccess = newDocument?.write(to: URL(fileURLWithPath: savePath))
+                    if writeSuccess == true {
+                        self.savePdf(savePath)
+//                        try? FileManager.default.removeItem(atPath: savePath)
+                    } else {
+                        
+                    }
+                }
+            }
+        }
     }
     @IBAction func screenShot_FullScreenDelay(_ sender: Any?) {
         KMPrint("screenShot_FullScreenDelay")
+        KMScreenShotHandler.beginScreenShot_FullSreenWithDelayTime(3) { ima in
+            if let image = ima {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                    let savePath = (NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last ?? "") + "/" + Bundle.main.bundleIdentifier! + "/screenShot.pdf"
+                    let newDocument = CPDFDocument()
+                    _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: newDocument?.pageCount ?? 0)
+                    let writeSuccess = newDocument?.write(to: URL(fileURLWithPath: savePath))
+                    if writeSuccess == true {
+                        self.savePdf(savePath)
+//                        try? FileManager.default.removeItem(atPath: savePath)
+                    } else {
+                        
+                    }
+                }
+            }
+        }
     }
     @IBAction func screenShot_FullScreen(_ sender: Any?) {
         KMPrint("screenShot_FullScreen")
+        KMScreenShotHandler.beginScreenShot_FullSreenWithDelayTime(0) { ima in
+            if let image = ima {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                    let savePath = (NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last ?? "") + "/" + Bundle.main.bundleIdentifier! + "/screenShot.pdf"
+                    let newDocument = CPDFDocument()
+                    _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: newDocument?.pageCount ?? 0)
+                    let writeSuccess = newDocument?.write(to: URL(fileURLWithPath: savePath))
+                    if writeSuccess == true {
+                        self.savePdf(savePath)
+//                        try? FileManager.default.removeItem(atPath: savePath)
+                    } else {
+                        
+                    }
+                }
+            }
+        }
     }
 }
 
@@ -1322,7 +1386,7 @@ extension KMBrowserWindowController: KMSystemViewMenuProtocol {
     func creatPdfFromImg(urls: Array<URL>)  {
 //        let savePath = self.newDocumentTempSavePath("convertToPDF.pdf")
         let pdf = CPDFDocument()
-        var isSucceed = true
+//        var isSucceed = true
         
         let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
         let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String)
@@ -1377,8 +1441,15 @@ extension KMBrowserWindowController: KMSystemViewMenuProtocol {
     func savePdf(_ filePath: String) -> Void {
         let docVc = KMDocumentController.shared
         
-        docVc.openDocument(withContentsOf: URL(fileURLWithPath: filePath), display: true) { doc, suc, err in
-            try? FileManager.default.removeItem(atPath: filePath)
+        docVc.openDocument(withContentsOf: URL(fileURLWithPath: filePath), display: true) { document, documentWasAlreadyOpen, error in
+            if error != nil {
+                NSApp.presentError(error!)
+            } else {
+                if document is KMMainDocument {
+                    let newDocument = document
+                    (newDocument as! KMMainDocument).isNewCreated = true
+                }
+            }
         }
     }
     

+ 96 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotEditViewController.swift

@@ -0,0 +1,96 @@
+//
+//  KMScreenShotEditViewController.swift
+//  PDF Reader Pro
+//
+//  Created by liujiajie on 2024/1/24.
+//
+
+import Cocoa
+
+typealias editButtonClickCallBack = (_ captureOrNot: Bool) -> ()
+typealias editSizeCallBack = (_ size: CGSize) -> ()
+
+let KTextFieldFontSize = 12//输入框大小
+let KLabelFontSize = 14//提示框字体大小
+let kLeftRightGap = 10//左右边距
+let kTopBottomGap = 10//上下边距
+let kMaskViewBorderLineWidth = 8 //maskView的线边框
+let selectMinWidthAndHeight = 40
+
+class KMScreenShotEditViewController: NSViewController{
+    @IBOutlet var widthIdentifyLabel: NSTextField!
+    @IBOutlet var heightIdentifyLabel: NSTextField!
+    @IBOutlet var widthLabel: NSTextField!
+    @IBOutlet var heightLabel: NSTextField!
+    @IBOutlet var confirmButton: NSButton!
+    @IBOutlet var cancelButton: NSButton!
+    @IBOutlet var widthStepper: NSStepper!
+    @IBOutlet var heightStepper: NSStepper!
+
+    var buttonCallBack: editButtonClickCallBack?
+    var sizeCallBack: editSizeCallBack?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        view.wantsLayer = true
+        view.layer?.backgroundColor = KMAppearance.viewBackgroundColor().cgColor
+        localizedLanguage()
+    }
+    func localizedLanguage() {
+        widthIdentifyLabel.stringValue = NSLocalizedString("Width", comment: "") + ":"
+        heightIdentifyLabel.stringValue = NSLocalizedString("Height", comment: "") + ":"
+        confirmButton.title = NSLocalizedString("OK", comment: "")
+        cancelButton.title = NSLocalizedString("Cancel", comment: "")
+    }
+    @IBAction func buttonClicked_ConfirmButton(_ sender: Any) {
+        if let callback = buttonCallBack {
+            callback(true)
+        }
+    }
+    @IBAction func buttonClicked_CancelButton(_ sender: Any) {
+        if let callback = buttonCallBack {
+            callback(false)
+        }
+    }
+    @IBAction func stepperClicked_WidthStepper(_ sender: NSStepper) {
+        widthLabel.integerValue = widthStepper.integerValue
+        heightLabel.integerValue = heightStepper.integerValue
+        if widthStepper.integerValue >= selectMinWidthAndHeight && heightStepper.integerValue >= selectMinWidthAndHeight {
+            sizeCallBack?(CGSize(width: widthStepper.integerValue, height: heightStepper.integerValue))
+        } else {
+            sender.integerValue = selectMinWidthAndHeight
+        }
+    }
+    @IBAction func stepperClicked_HeightStepper(_ sender: NSStepper) {
+        widthLabel.integerValue = widthStepper.integerValue
+        heightLabel.integerValue = heightStepper.integerValue
+        if widthStepper.integerValue >= selectMinWidthAndHeight && heightStepper.integerValue >= selectMinWidthAndHeight {
+            sizeCallBack?(CGSize(width: widthStepper.integerValue, height: heightStepper.integerValue))
+        } else {
+            sender.integerValue = selectMinWidthAndHeight
+        }
+    }
+    func updateSize(withRect rect: CGRect) {
+        widthLabel.integerValue = Int(rect.size.width)
+        heightLabel.integerValue = Int(rect.size.height)
+        guard let screen = NSScreen.screens.first else { return }
+        let xMax = screen.frame.size.width
+        let yMax = screen.frame.size.height
+        
+        widthStepper.minValue = Double(selectMinWidthAndHeight)
+        widthStepper.minValue = Double(selectMinWidthAndHeight)
+        
+        widthStepper.maxValue = Double(xMax - rect.origin.x)
+        heightStepper.maxValue = Double(yMax - rect.origin.y)
+        
+        widthStepper.valueWraps = false
+        widthStepper.valueWraps = false
+        
+        widthStepper.increment = 1.0
+        heightStepper.increment = 1.0
+        
+        widthStepper.integerValue = Int(rect.size.width)
+        heightStepper.integerValue = Int(rect.size.height)
+    }
+}
+

+ 128 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotEditViewController.xib

@@ -0,0 +1,128 @@
+<?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="KMScreenShotEditViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="cancelButton" destination="QtS-lt-sQP" id="xof-g5-e6h"/>
+                <outlet property="confirmButton" destination="a1A-fC-bwR" id="xyj-Mq-Zb7"/>
+                <outlet property="heightIdentifyLabel" destination="CB0-qG-FAs" id="uy8-k6-0xI"/>
+                <outlet property="heightLabel" destination="sft-Tq-YTs" id="Sg3-dL-vYR"/>
+                <outlet property="heightStepper" destination="VD5-eA-egT" id="OMi-34-xCd"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+                <outlet property="widthIdentifyLabel" destination="uAO-cn-tjZ" id="F08-tn-eyf"/>
+                <outlet property="widthLabel" destination="Sng-bk-6xH" id="3aZ-U5-3bb"/>
+                <outlet property="widthStepper" destination="9tO-9w-vfj" id="83P-RP-4Jd"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="212" height="62"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uAO-cn-tjZ">
+                    <rect key="frame" x="8" y="36" width="44" height="16"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Width:" id="Sbm-hP-Bma">
+                        <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 focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CB0-qG-FAs">
+                    <rect key="frame" x="8" y="10" width="48" height="16"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Height:" id="Jsf-Fm-kcX">
+                        <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 focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Sng-bk-6xH">
+                    <rect key="frame" x="53" y="36" width="44" height="16"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="40" id="uGl-r6-esr"/>
+                    </constraints>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="100" id="1eD-Wk-QJ4">
+                        <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 focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sft-Tq-YTs">
+                    <rect key="frame" x="57" y="10" width="44" height="16"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="40" id="4iR-fJ-mYE"/>
+                    </constraints>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="100" id="w1W-iz-gIu">
+                        <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>
+                <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9tO-9w-vfj">
+                    <rect key="frame" x="96" y="30" width="19" height="28"/>
+                    <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="7QU-Ll-j2h"/>
+                    <connections>
+                        <action selector="stepperClicked_HeightStepper:" target="-2" id="QcT-M5-Yl9"/>
+                    </connections>
+                </stepper>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="a1A-fC-bwR">
+                    <rect key="frame" x="125" y="27" width="84" height="32"/>
+                    <buttonCell key="cell" type="push" title="ok" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1XN-UV-1ss">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                    <connections>
+                        <action selector="buttonClicked_ConfirmButton:" target="-2" id="kjX-Ff-ACP"/>
+                    </connections>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QtS-lt-sQP">
+                    <rect key="frame" x="125" y="1" width="84" height="32"/>
+                    <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="86U-gD-RIG">
+                        <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="buttonClicked_CancelButton:" target="-2" id="5Pq-ft-8Pd"/>
+                    </connections>
+                </button>
+                <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VD5-eA-egT">
+                    <rect key="frame" x="96" y="4" width="19" height="28"/>
+                    <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="8dU-Xa-Gbb"/>
+                    <connections>
+                        <action selector="stepperClicked_HeightStepper:" target="-2" id="4sd-03-dDk"/>
+                    </connections>
+                </stepper>
+            </subviews>
+            <constraints>
+                <constraint firstItem="a1A-fC-bwR" firstAttribute="leading" secondItem="9tO-9w-vfj" secondAttribute="trailing" constant="20" id="4u8-Sb-943"/>
+                <constraint firstItem="Sng-bk-6xH" firstAttribute="leading" secondItem="uAO-cn-tjZ" secondAttribute="trailing" constant="5" id="56j-Rw-AfV"/>
+                <constraint firstItem="VD5-eA-egT" firstAttribute="leading" secondItem="9tO-9w-vfj" secondAttribute="leading" id="AmS-ei-ssQ"/>
+                <constraint firstItem="Sng-bk-6xH" firstAttribute="centerY" secondItem="uAO-cn-tjZ" secondAttribute="centerY" id="Go8-YQ-eJH"/>
+                <constraint firstItem="CB0-qG-FAs" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="10" id="IEE-ri-l9K"/>
+                <constraint firstItem="uAO-cn-tjZ" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="J6a-60-MHV"/>
+                <constraint firstItem="uAO-cn-tjZ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="10" id="NA6-J3-VxJ"/>
+                <constraint firstItem="QtS-lt-sQP" firstAttribute="width" secondItem="a1A-fC-bwR" secondAttribute="width" id="Qs3-27-bhM"/>
+                <constraint firstItem="9tO-9w-vfj" firstAttribute="centerY" secondItem="uAO-cn-tjZ" secondAttribute="centerY" id="UNV-0x-Hrq"/>
+                <constraint firstItem="CB0-qG-FAs" firstAttribute="top" secondItem="uAO-cn-tjZ" secondAttribute="bottom" constant="10" id="VYg-jX-mI8"/>
+                <constraint firstItem="sft-Tq-YTs" firstAttribute="centerY" secondItem="CB0-qG-FAs" secondAttribute="centerY" id="WUh-R3-9cM"/>
+                <constraint firstAttribute="bottom" secondItem="CB0-qG-FAs" secondAttribute="bottom" constant="10" id="ZGe-BN-cl5"/>
+                <constraint firstItem="VD5-eA-egT" firstAttribute="centerY" secondItem="CB0-qG-FAs" secondAttribute="centerY" id="dVc-Cz-ifU"/>
+                <constraint firstItem="sft-Tq-YTs" firstAttribute="leading" secondItem="CB0-qG-FAs" secondAttribute="trailing" constant="5" id="eDk-nI-Qbh"/>
+                <constraint firstItem="VD5-eA-egT" firstAttribute="leading" secondItem="sft-Tq-YTs" secondAttribute="trailing" id="fvk-g9-lsX"/>
+                <constraint firstItem="QtS-lt-sQP" firstAttribute="leading" secondItem="a1A-fC-bwR" secondAttribute="leading" id="h64-ph-yxI"/>
+                <constraint firstItem="QtS-lt-sQP" firstAttribute="centerY" secondItem="CB0-qG-FAs" secondAttribute="centerY" id="n3J-Ld-Fux"/>
+                <constraint firstItem="a1A-fC-bwR" firstAttribute="centerY" secondItem="uAO-cn-tjZ" secondAttribute="centerY" id="vBd-gP-yr0"/>
+                <constraint firstAttribute="trailing" secondItem="a1A-fC-bwR" secondAttribute="trailing" constant="10" id="xhO-MC-PhE"/>
+            </constraints>
+            <point key="canvasLocation" x="-9" y="86"/>
+        </customView>
+    </objects>
+</document>

+ 142 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotHandler.swift

@@ -0,0 +1,142 @@
+//
+//  KMScreenShotHandler.swift
+//  PDF Reader Pro
+//
+//  Created by liujiajie on 2024/1/24.
+//
+
+import Foundation
+
+let KMCancelCurrentCapturingActionNotification = "KMCancelCurrentCapturingActionNotification"
+
+class KMScreenShotHandler: NSObject{
+    var isCapturing = false
+    
+    static let defaultManager = KMScreenShotHandler()
+    
+    class func fullScreenShot() -> NSImage {
+        var screenShot = CGWindowListCreateImage(.infinite, .optionOnScreenOnly, kCGNullWindowID, [])
+        let img2 = NSImage(cgImage: screenShot!, size: NSZeroSize)
+        screenShot = nil
+        return img2
+    }
+    
+    class func appointWindowScreenShot(withWindowID windowID: CGWindowID) -> NSImage? {
+        let windowImage = CGWindowListCreateImage(.null, .optionIncludingWindow, windowID, [])
+        let newImage = imageFromCGImageRef(windowImage)
+        return newImage
+    }
+    
+    class func imageFromCGImageRef(_ image: CGImage?) -> NSImage? {
+        var imageRect = NSRect(x: 0.0, y: 0.0, width: 0.0, height: 0.0)
+        var imageContext: CGContext?
+        var newImage: NSImage?
+        // Get the image dimensions.
+        imageRect.size.height = CGFloat(image?.height ?? 0)
+        imageRect.size.width = CGFloat(image?.width ?? 0)
+        
+        // Create a new image to receive the Quartz image data.
+        if imageRect.size == CGSize.zero {
+            return newImage
+        }
+        
+        newImage = NSImage(size: imageRect.size)
+        newImage?.lockFocus()
+        
+        // Get the Quartz context and draw.
+        imageContext = NSGraphicsContext.current?.cgContext
+        imageContext?.draw(image!, in: NSRectToCGRect(imageRect))
+        
+        newImage?.unlockFocus()
+        return newImage
+    }
+    
+    class func screenPosition(for event: NSEvent) -> CGPoint {
+        var point = event.locationInWindow
+        point.x += event.window?.frame.origin.x ?? 0
+        point.y += event.window?.frame.origin.y ?? 0
+        return point
+    }
+    
+    class func calculateString(_ aString: String, font aFont: NSFont) -> CGSize {
+        let attributeString = NSMutableAttributedString(string: aString)
+        let style = NSMutableParagraphStyle()
+        style.lineSpacing = 10
+        attributeString.addAttribute(.paragraphStyle, value: style, range: NSRange(location: 0, length: aString.count))
+        attributeString.addAttribute(.font, value: aFont, range: NSRange(location: 0, length: aString.count))
+        let options: NSString.DrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading]
+        let rect = attributeString.boundingRect(with: CGSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude), options: options, context: nil)
+        return CGSize(width: rect.size.width + 10, height: rect.size.height)
+    }
+    
+    class func imageToPDFViaSavePanel(_ image: NSImage) {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+            let savePanel = NSSavePanel()
+            let originalPDFName = "untitled"
+            savePanel.nameFieldStringValue = originalPDFName + "_ScreenShot"
+            savePanel.allowedFileTypes = ["pdf"] 
+            savePanel.begin { (result) in
+                if result == .OK {
+                    let newDocument = CPDFDocument()
+                    _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: 0)
+                    let isSuccess = newDocument?.write(to: savePanel.url!)
+                    if isSuccess ?? false {
+                        NSDocumentController.shared.openDocument(withContentsOf: savePanel.url!, display: true) { (document, documentWasAlreadyOpen, error) in
+                            // Handle completion
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    class func imageToPDF(_ image: NSImage) -> CPDFDocument? {
+        let newDocument = CPDFDocument()
+        _ = newDocument?.km_insert(imageData: image.jpgData() ?? Data(), pageSize: image.size, at: 0)
+        let savePath = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last!.appending("/\(Bundle.main.bundleIdentifier!)/ScreenShot.pdf")
+        let isSuccess = newDocument?.write(to: URL(fileURLWithPath: savePath))
+        if isSuccess ?? false {
+            return newDocument
+        }
+        return nil
+    }
+    
+    class func beginScreenShot_SelectWindowCompleteHandler(_ handler: @escaping captureScreenCallBack) {
+        if KMScreenShotHandler.defaultManager.isCapturing == true {
+            NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
+        }
+        let screenShotWindow = KMScreenShotMaskWindowController { (ima) in
+            if let image = ima {
+                handler(image)
+            }
+        }
+        screenShotWindow.beginImageCapture(true)
+    }
+    class func beginScreenShot_FullSreenWithDelayTime(_ delayTime: NSInteger, completeHandler handler: @escaping captureScreenCallBack) {
+        if KMScreenShotHandler.defaultManager.isCapturing {
+            NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
+        }
+        KMScreenShotHandler.defaultManager.isCapturing = true
+        let screenShotWindow = KMScreenShotMaskWindowController(fullScreenShot: delayTime, completeHandler: { (ima) in
+            KMScreenShotHandler.defaultManager.isCapturing = false
+            if let image = ima {
+                handler(image)
+            }
+        })
+    }
+    class func beginScreenshot_SelectRectWithCompleteHandler(_ handler: @escaping captureScreenCallBack) {
+        if KMScreenShotHandler.defaultManager.isCapturing {
+            NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
+        }
+        let screenShotWindow = KMScreenShotMaskWindowController( handler: { (ima) in
+            if let image = ima {
+                handler(image)
+            }
+        })
+        screenShotWindow.beginImageCapture(false)
+    }
+//    func setIsCapturing(iscapturing: Bool) {
+//        self.isCapturing = iscapturing
+//    }
+}
+

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 647 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotMaskView.swift


+ 111 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotMaskViewController.swift

@@ -0,0 +1,111 @@
+//
+//  KMScreenShotMaskViewController.swift
+//  PDF Reader Pro
+//
+//  Created by liujiajie on 2024/1/24.
+//
+
+import Cocoa
+
+let keditViewGap = 5
+
+class KMScreenShotMaskViewController: NSViewController{
+    @IBOutlet var screenShotMaskView: KMScreenShotMaskView!
+    var editViewController: KMScreenShotEditViewController!
+    var holeDragImageView: NSImageView!
+    var callBack: captureScreenCallBack?
+
+    convenience init(callB: @escaping captureScreenCallBack) {
+        self.init(nibName: "KMScreenShotMaskViewController", bundle: nil)
+        self.callBack = callB
+    }
+    
+    override func loadView() {
+        super.loadView()
+        initViews()
+        handlerCallBack()
+    }
+    func initViews() {
+        view.wantsLayer = true
+        view.layer?.backgroundColor = NSColor.clear.cgColor
+        screenShotMaskView.frame = view.frame
+        
+        editViewController = KMScreenShotEditViewController(nibName: "KMScreenShotEditViewController", bundle: nil)
+        view.addSubview(editViewController.view)
+        editViewController.view.isHidden = true
+        
+        holeDragImageView = NSImageView(frame: NSRect(x: 0, y: 0, width: 40, height: 40))
+        view.addSubview(holeDragImageView)
+        holeDragImageView.isHidden = true
+        holeDragImageView.image = NSImage(named: "drag.png")
+    }
+    func handlerCallBack() {
+        self.screenShotMaskView.callBack = self.callBack
+        
+        self.screenShotMaskView.frameCallBack = { rect in
+            if self.editViewController.view.isHidden {
+                self.editViewController.view.isHidden = false
+            }
+            if self.holeDragImageView.isHidden{
+                self.holeDragImageView.isHidden = false
+            }
+            self.editViewController.updateSize(withRect: rect)
+            self.updateEditViewFrame(with: rect)
+            self.updateHoleButtonPosition(rect)
+        }
+        
+        self.editViewController.buttonCallBack = { [weak self] captureOrNot in
+            self!.holeDragImageView.isHidden = true
+            if captureOrNot {
+                self!.screenShotMaskView.captureImage()
+            } else {
+                self!.screenShotMaskView.endImageCapture()
+            }
+        }
+        
+        self.editViewController.sizeCallBack = { [weak self] size in
+            self!.screenShotMaskView.updateholeSize(newSize: size)
+            self?.updateHoleButtonPositionWithHoleSize(holeSize: size)
+        }
+        
+        self.screenShotMaskView.detachCallBack = { [weak self] event in
+            let cursorPoint = KMScreenShotHandler.screenPosition(for: event)
+            self?.screenShotMaskView.holeDragMode = NSPointInRect(cursorPoint, NSMakeRect((self?.screenShotMaskView.borderFrame.origin.x ?? 0) + 4, (self?.screenShotMaskView.borderFrame.origin.y ?? 0) + 4, (self?.screenShotMaskView.borderFrame.size.width ?? 0) - 8, (self?.screenShotMaskView.borderFrame.size.height ?? 0) - 8))
+        }
+    }
+    func beginImageCapture(_ isCaptureWindow: Bool) {
+        self.holeDragImageView.isHidden = true
+        if isCaptureWindow {
+            self.editViewController.view.isHidden = true
+        }
+        self.screenShotMaskView.beginImageCapture(isCaptureWindow: isCaptureWindow)
+    }
+    func updateHoleButtonPositionWithHoleSize(holeSize: CGSize) {
+        self.holeDragImageView.frame = NSMakeRect(self.screenShotMaskView.borderFrame.origin.x + holeSize.width/2 - self.holeDragImageView.frame.size.width/2, self.screenShotMaskView.borderFrame.origin.y + holeSize.height/2 - self.holeDragImageView.frame.size.height/2, self.holeDragImageView.frame.size.width, self.holeDragImageView.frame.size.height)
+    }
+    func updateHoleButtonPosition(_ rect: NSRect) {
+        self.holeDragImageView.frame = NSMakeRect(NSMidX(rect) - self.holeDragImageView.frame.size.width/2, NSMidY(rect) - self.holeDragImageView.frame.size.height/2, self.holeDragImageView.frame.size.width, self.holeDragImageView.frame.size.height)
+    }
+    func updateEditViewFrame(with aRect: NSRect) {
+        let viewWidth = self.editViewController.view.frame.size.width
+        let viewHeight = self.editViewController.view.frame.size.height
+        var newRect = NSMakeRect(NSMinX(aRect), NSMinY(aRect) - viewHeight - CGFloat(keditViewGap), viewWidth, viewHeight)
+        if NSMinY(newRect) < 0 {
+            newRect.origin.x = NSMinX(newRect) - viewWidth - CGFloat(keditViewGap)
+            newRect.origin.y = NSMinY(aRect) + CGFloat(keditViewGap)
+            if newRect.origin.x < 0 { 
+                newRect.origin.x = NSMinX(aRect) + CGFloat(keditViewGap)
+            }
+        }
+        let screenFrame = NSScreen.screens.first!.frame
+        if NSMaxX(screenFrame) < NSMaxX(newRect) {
+            newRect.origin.x = screenFrame.size.width - viewWidth
+        }
+        
+        if NSMaxY(screenFrame) < NSMaxY(newRect) {
+            newRect.origin.y = screenFrame.size.height - viewHeight
+        }
+        
+        self.editViewController.view.frame = newRect
+    }
+}

+ 29 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotMaskViewController.xib

@@ -0,0 +1,29 @@
+<?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="KMScreenShotMaskViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="screenShotMaskView" destination="xBN-O3-H4m" id="Bri-Yn-Aeh"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xBN-O3-H4m" customClass="KMScreenShotMaskView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                    <rect key="frame" x="165" y="117" width="151" height="38"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                </customView>
+            </subviews>
+            <point key="canvasLocation" x="10" y="78"/>
+        </customView>
+    </objects>
+</document>

+ 172 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotMaskWindowController.swift

@@ -0,0 +1,172 @@
+//
+//  KMScreenShotMaskWindowController.swift
+//  PDF Reader Pro
+//
+//  Created by liujiajie on 2024/1/24.
+//
+
+import Cocoa
+
+let ktimeLabelWidthAndHeight: CGFloat = 100
+let kdefauletDelaytime: CGFloat = 5
+
+class KMScreenShotMaskWindowController: NSWindowController{
+    var maskViewController: KMScreenShotMaskViewController!
+    @IBOutlet var timeLabel: NSTextField!
+    var fullScreenCallBack: captureScreenCallBack?
+    var countDownTimer: Timer?
+    
+    var countDownSurplusTime: Int = 0
+    var localMonitor: Any?
+    var globalMonitor: Any?
+    
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        if (countDownTimer != nil){
+            countDownTimer?.invalidate()
+            countDownTimer = nil
+        }
+    }
+    convenience init( handler: @escaping captureScreenCallBack) {
+        self.init(windowNibName: "KMScreenShotMaskWindowController")
+        self.window?.backgroundColor = .clear
+        self.window?.isOpaque = false
+        let screen = NSScreen.screens.first
+        self.window?.setFrame(screen?.frame ?? .zero, display: false)
+        self.window?.level =  NSWindow.Level(Int(kCGOverlayWindowLevel)) //NSWindow.Level(rawValue: Int(kCGOverlayWindowLevel))
+        self.maskViewController = KMScreenShotMaskViewController(callB: handler)
+        self.maskViewController.view.frame = self.window?.frame ?? .zero
+        self.window?.contentView!.addSubview(self.maskViewController.view)
+        self.timeLabel.isHidden = true
+    }
+    
+    convenience init(fullScreenShot delayTime: Int, completeHandler:  @escaping captureScreenCallBack) {
+        self.init(windowNibName: "KMScreenShotMaskWindowController")
+        self.countDownSurplusTime = delayTime
+        self.window?.backgroundColor = NSColor.black
+        if let screen = NSScreen.screens.first {
+            self.window?.setFrame(NSRect(x: screen.frame.size.width/2 - ktimeLabelWidthAndHeight/2, y: screen.frame.size.height/2 - ktimeLabelWidthAndHeight/2, width: ktimeLabelWidthAndHeight, height: ktimeLabelWidthAndHeight), display: false)
+        }
+        self.window?.level = NSWindow.Level(Int(kCGOverlayWindowLevel))
+        self.timeLabel.font = NSFont.systemFont(ofSize: 100)
+        self.timeLabel.textColor = NSColor.white
+        self.window?.alphaValue = 0.3
+        self.timeLabel.integerValue = self.countDownSurplusTime
+        self.timeLabel.sizeToFit()
+        self.timeLabel.frame = NSRect(x: (ktimeLabelWidthAndHeight - self.timeLabel.frame.size.width)/2, y: (ktimeLabelWidthAndHeight - self.timeLabel.frame.size.height)/2, width: self.timeLabel.frame.size.width, height: self.timeLabel.frame.size.height)
+        if delayTime == 0 {
+            self.window?.setIsVisible(false)
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                let ima = KMScreenShotHandler.fullScreenShot()
+                completeHandler(ima)
+            }
+        } else {
+            self.timeLabel.isHidden = false
+            let sel = NSSelectorFromString("countTimer_Method:")
+            self.countDownTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: sel, userInfo: nil, repeats: true)
+            
+            RunLoop.current.add(self.countDownTimer!, forMode: .common)
+            self.fullScreenCallBack = completeHandler
+            if self.localMonitor == nil {
+                let mask: NSEvent.EventTypeMask = [.leftMouseDown, .keyDown]
+                self.localMonitor = NSEvent.addLocalMonitorForEvents(matching: mask, handler: { (event) -> NSEvent? in
+                    if event.type == .keyDown {
+                        if event.keyCode == 53 {
+                            self.endFullScreenShot()
+                            self.fullScreenCallBack?(nil)
+                        }
+                    }
+                    return nil
+                })
+            }
+            if self.globalMonitor == nil {
+                self.globalMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown, handler: { (event) in
+                    if event.type == .keyDown {
+                        if event.keyCode == 53 {
+                            self.endFullScreenShot()
+                            self.fullScreenCallBack?(nil)
+                        }
+                    }
+                })
+            }
+        }
+        NotificationCenter.default.addObserver(self, selector: #selector(cancelCurrentCapturingAction(notification:)), name: NSNotification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
+    }
+    @objc func cancelCurrentCapturingAction(notification: Notification) {
+        DispatchQueue.main.async {
+            self.endFullScreenShot()
+        }
+    }
+    func endFullScreenShot() {
+        self.countDownTimer?.invalidate()
+        self.window?.setIsVisible(false)
+        NSEvent.removeMonitor(self.localMonitor as Any)
+        self.localMonitor = nil
+        NSEvent.removeMonitor(self.globalMonitor as Any)
+        self.globalMonitor = nil
+    }
+    @objc func countTimer_Method(_ sender: Any) {
+        self.countDownSurplusTime -= 1
+        self.timeLabel.integerValue = self.countDownSurplusTime
+        if self.countDownSurplusTime == 0 {
+            self.endFullScreenShot()
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+                let ima = KMScreenShotHandler.fullScreenShot()
+                self.fullScreenCallBack?(ima)
+            }
+        }
+    }
+    override func windowDidLoad() {
+        super.windowDidLoad()
+    }
+    
+    func beginImageCapture(_ isCaptureWindow: Bool) { self.maskViewController.beginImageCapture(isCaptureWindow)
+        if isCaptureWindow {
+            let cursor = NSCursor(image: NSImage(named: "cameraCursor") ?? NSImage(), hotSpot: NSPoint(x: 0, y: 0))
+            cursor.set()
+            self.showScreenShotHint(NSLocalizedString("Move the camera over the window you want to capture.", comment: ""))
+        } else {
+            NSCursor.crosshair.set()
+            self.showScreenShotHint(NSLocalizedString("Drag the crosshair over the area you want to capture.", comment: ""))
+        }
+    }
+    
+    func showScreenShotHint(_ hintMsg: String) {
+        let topBottomGap: CGFloat = 10
+        let texfield = NSTextField()
+        texfield.isBordered = false
+        texfield.font = NSFont.systemFont(ofSize: 20)
+        texfield.textColor = NSColor.white
+        texfield.backgroundColor = NSColor.clear
+        texfield.stringValue = hintMsg
+        texfield.sizeToFit()
+        let hintContainer = NSView()
+        hintContainer.wantsLayer = true
+        hintContainer.layer?.backgroundColor = NSColor.black.cgColor
+        hintContainer.addSubview(texfield)
+        
+        var containerFrame = hintContainer.frame
+        containerFrame.size.height = texfield.frame.size.height + topBottomGap * 2
+        containerFrame.size.width = texfield.frame.size.width + containerFrame.size.height
+        containerFrame.origin.x = ((self.window?.contentView?.frame.size.width ?? 0) - containerFrame.size.width) / 2
+        containerFrame.origin.y = ((self.window?.contentView?.frame.size.height ?? 0) - containerFrame.size.height) / 2
+        hintContainer.frame = containerFrame
+        
+        var textfieldFrame = texfield.frame
+        textfieldFrame.origin.x = (containerFrame.size.width - texfield.frame.size.width) / 2
+        textfieldFrame.origin.y = topBottomGap
+        texfield.frame = textfieldFrame
+        
+        hintContainer.layer?.cornerRadius = containerFrame.size.height / 2
+        self.window?.contentView?.addSubview(hintContainer)
+        
+        NSAnimationContext.runAnimationGroup({ (context) in
+            context.duration = 3
+            hintContainer.animator().alphaValue = 0.0
+        }, completionHandler: {
+            
+        })
+    }
+}
+
+

+ 44 - 0
PDF Office/PDF Master/Class/ChromiumTabs/Screen/KMScreenShotMaskWindowController.xib

@@ -0,0 +1,44 @@
+<?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="KMScreenShotMaskWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="timeLabel" destination="kT8-FU-lWi" id="T2Y-5J-xcI"/>
+                <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" hasShadow="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" fullSizeContentView="YES"/>
+            <windowCollectionBehavior key="collectionBehavior" canJoinAllSpaces="YES" managed="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="480" height="270"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kT8-FU-lWi">
+                        <rect key="frame" x="154" y="138" width="37" height="17"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="kl2-sP-IOO">
+                            <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>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="257" y="-67"/>
+        </window>
+    </objects>
+</document>

+ 12 - 0
PDF Office/PDF Master/Class/ChromiumTabs/TabsImage.xcassets/cameraCursor.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "cameraCursor.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/ChromiumTabs/TabsImage.xcassets/cameraCursor.imageset/cameraCursor.pdf


+ 3 - 1
PDF Office/PDF Master/Class/Common/OC/Batch/KMOCTool.h

@@ -6,6 +6,8 @@
 //
 
 #import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+#import <Cocoa/Cocoa.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -13,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 +(void)createPDFFile:(NSString *)filePath imagePaths:(NSArray *)paths results:(NSArray *)resultsArray scale:(CGFloat)scale;
 +(NSData*)convertStringsToPDFWithString:(NSArray *)strings;
-
++(CGRect)localCropRectForWindow:(CGWindowID)wNumber withBounds:(CGRect)bounds;
 @end
 
 NS_ASSUME_NONNULL_END

+ 65 - 2
PDF Office/PDF Master/Class/Common/OC/Batch/KMOCTool.m

@@ -7,8 +7,6 @@
 
 #import "KMOCTool.h"
 #import <Foundation/Foundation.h>
-#import <CoreGraphics/CoreGraphics.h>
-#import <Cocoa/Cocoa.h>
 #import <PDF_Reader_Pro-Swift.h>
 
 @implementation KMOCTool
@@ -98,6 +96,71 @@
     CGContextRelease (pdfContext);
 }
 
++ (CGRect)localCropRectForWindow:(CGWindowID)wNumber withBounds:(CGRect)bounds{
+    CFArrayRef tarray = CGWindowListCreate(kCGWindowListOptionOnScreenOnly,
+                                           (CGWindowID)wNumber);
+    CFArrayRef array = CGWindowListCreateDescriptionFromArray(tarray);
+    CFRelease(tarray);
+    
+    CGRect cropRect = bounds;
+    for (NSDictionary *windowInfo in CFBridgingRelease(array)) {
+        if ([windowInfo[(__bridge NSString*)kCGWindowNumber] integerValue] == wNumber) {
+            NSDictionary *rectInfo = windowInfo[(__bridge NSString*)kCGWindowBounds];
+            
+            NSScreen *mainScreen = nil;
+            for (NSScreen *screen in [NSScreen screens]) {
+                if (CGPointEqualToPoint(screen.frame.origin, CGPointZero))
+                    mainScreen = screen;
+            }
+            
+            CGPoint center = CGPointMake([rectInfo[@"X"] floatValue] + [rectInfo[@"Width"] floatValue]/2,
+                                         mainScreen.frame.size.height - [rectInfo[@"Y"] floatValue] - [rectInfo[@"Height"] floatValue]/2);
+            
+            NSScreen *curScreen = nil;
+            for (NSScreen *screen in [NSScreen screens]) {
+                if (CGRectContainsPoint(screen.frame, center)) {
+                    curScreen = screen;
+                    break;
+                }
+            }
+            if (!curScreen) {
+                center = CGPointMake([rectInfo[@"X"] floatValue],
+                                     mainScreen.frame.size.height - [rectInfo[@"Y"] floatValue]);
+                
+                for (NSScreen *screen in [NSScreen screens]) {
+                    if (CGRectContainsPoint(screen.frame, center)) {
+                        curScreen = screen;
+                        break;
+                    }
+                }
+                
+                if (!curScreen) {
+                    center = CGPointMake([rectInfo[@"X"] floatValue] + [rectInfo[@"Width"] floatValue],
+                                         mainScreen.frame.size.height - [rectInfo[@"Y"] floatValue]);
+                    
+                    for (NSScreen *screen in [NSScreen screens]) {
+                        if (CGRectContainsPoint(screen.frame, center)) {
+                            curScreen = screen;
+                            break;
+                        }
+                    }
+                }
+            }
+            if (curScreen) {
+                float y = mainScreen.frame.size.height - [rectInfo[@"Y"] floatValue] - curScreen.frame.origin.y;
+                cropRect = CGRectMake([rectInfo[@"X"] floatValue] - curScreen.frame.origin.x,
+                                      y - [rectInfo[@"Height"] floatValue],
+                                      [rectInfo[@"Width"] floatValue],
+                                      [rectInfo[@"Height"] floatValue]);
+            }else {
+        
+            }
+            break;
+        }
+    }
+    return cropRect;
+}
+
 +(NSData*)convertStringsToPDFWithString:(NSArray *)strings{
     return convertStringsToPDF(strings);
 }

+ 72 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -4623,6 +4623,30 @@
 		BBF8A4032AE8E10100788BAC /* KMBatchConvertParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A4022AE8E10100788BAC /* KMBatchConvertParameter.swift */; };
 		BBF8A4042AE8E10100788BAC /* KMBatchConvertParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A4022AE8E10100788BAC /* KMBatchConvertParameter.swift */; };
 		BBF8A4052AE8E10100788BAC /* KMBatchConvertParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A4022AE8E10100788BAC /* KMBatchConvertParameter.swift */; };
+		BBFA1CC92B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CC82B60967A0053AD4A /* KMScreenShotHandler.swift */; };
+		BBFA1CCA2B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CC82B60967A0053AD4A /* KMScreenShotHandler.swift */; };
+		BBFA1CCB2B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CC82B60967A0053AD4A /* KMScreenShotHandler.swift */; };
+		BBFA1CCD2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CCC2B609E890053AD4A /* KMScreenShotMaskWindowController.swift */; };
+		BBFA1CCE2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CCC2B609E890053AD4A /* KMScreenShotMaskWindowController.swift */; };
+		BBFA1CCF2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CCC2B609E890053AD4A /* KMScreenShotMaskWindowController.swift */; };
+		BBFA1CD12B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CD02B609EC50053AD4A /* KMScreenShotMaskWindowController.xib */; };
+		BBFA1CD22B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CD02B609EC50053AD4A /* KMScreenShotMaskWindowController.xib */; };
+		BBFA1CD32B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CD02B609EC50053AD4A /* KMScreenShotMaskWindowController.xib */; };
+		BBFA1CD62B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD52B60A0670053AD4A /* KMScreenShotMaskView.swift */; };
+		BBFA1CD72B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD52B60A0670053AD4A /* KMScreenShotMaskView.swift */; };
+		BBFA1CD82B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD52B60A0670053AD4A /* KMScreenShotMaskView.swift */; };
+		BBFA1CDA2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD92B60DBF90053AD4A /* KMScreenShotMaskViewController.swift */; };
+		BBFA1CDB2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD92B60DBF90053AD4A /* KMScreenShotMaskViewController.swift */; };
+		BBFA1CDC2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CD92B60DBF90053AD4A /* KMScreenShotMaskViewController.swift */; };
+		BBFA1CDE2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CDD2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib */; };
+		BBFA1CDF2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CDD2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib */; };
+		BBFA1CE02B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CDD2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib */; };
+		BBFA1CE22B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CE12B60DD970053AD4A /* KMScreenShotEditViewController.swift */; };
+		BBFA1CE32B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CE12B60DD970053AD4A /* KMScreenShotEditViewController.swift */; };
+		BBFA1CE42B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFA1CE12B60DD970053AD4A /* KMScreenShotEditViewController.swift */; };
+		BBFA1CE62B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CE52B60DDC40053AD4A /* KMScreenShotEditViewController.xib */; };
+		BBFA1CE72B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CE52B60DDC40053AD4A /* KMScreenShotEditViewController.xib */; };
+		BBFA1CE82B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BBFA1CE52B60DDC40053AD4A /* KMScreenShotEditViewController.xib */; };
 		BBFBE6BE28DD7B97008B2335 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFBE6BD28DD7B97008B2335 /* AppDelegate.swift */; };
 		BBFBE6C028DD7B97008B2335 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBFBE6BF28DD7B97008B2335 /* ViewController.swift */; };
 		BBFBE6C228DD7B98008B2335 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBFBE6C128DD7B98008B2335 /* Assets.xcassets */; };
@@ -6668,6 +6692,14 @@
 		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>"; };
 		BBF8A4022AE8E10100788BAC /* KMBatchConvertParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchConvertParameter.swift; sourceTree = "<group>"; };
+		BBFA1CC82B60967A0053AD4A /* KMScreenShotHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMScreenShotHandler.swift; sourceTree = "<group>"; };
+		BBFA1CCC2B609E890053AD4A /* KMScreenShotMaskWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMScreenShotMaskWindowController.swift; sourceTree = "<group>"; };
+		BBFA1CD02B609EC50053AD4A /* KMScreenShotMaskWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMScreenShotMaskWindowController.xib; sourceTree = "<group>"; };
+		BBFA1CD52B60A0670053AD4A /* KMScreenShotMaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMScreenShotMaskView.swift; sourceTree = "<group>"; };
+		BBFA1CD92B60DBF90053AD4A /* KMScreenShotMaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMScreenShotMaskViewController.swift; sourceTree = "<group>"; };
+		BBFA1CDD2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMScreenShotMaskViewController.xib; sourceTree = "<group>"; };
+		BBFA1CE12B60DD970053AD4A /* KMScreenShotEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMScreenShotEditViewController.swift; sourceTree = "<group>"; };
+		BBFA1CE52B60DDC40053AD4A /* KMScreenShotEditViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMScreenShotEditViewController.xib; sourceTree = "<group>"; };
 		BBFBE6BA28DD7B97008B2335 /* PDF Reader Pro.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PDF Reader Pro.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		BBFBE6BD28DD7B97008B2335 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		BBFBE6BF28DD7B97008B2335 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -7497,6 +7529,7 @@
 		9F1FE43429406DA900E952CA /* ChromiumTabs */ = {
 			isa = PBXGroup;
 			children = (
+				BBFA1CD42B60A04E0053AD4A /* Screen */,
 				9F1FE43529406E4700E952CA /* src */,
 				9F8539E1294711D400DF644E /* resources */,
 				9F1FE50C29407B2B00E952CA /* KMUploadFilePanel.swift */,
@@ -12120,6 +12153,21 @@
 			path = Data;
 			sourceTree = "<group>";
 		};
+		BBFA1CD42B60A04E0053AD4A /* Screen */ = {
+			isa = PBXGroup;
+			children = (
+				BBFA1CC82B60967A0053AD4A /* KMScreenShotHandler.swift */,
+				BBFA1CCC2B609E890053AD4A /* KMScreenShotMaskWindowController.swift */,
+				BBFA1CD02B609EC50053AD4A /* KMScreenShotMaskWindowController.xib */,
+				BBFA1CD92B60DBF90053AD4A /* KMScreenShotMaskViewController.swift */,
+				BBFA1CDD2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib */,
+				BBFA1CE12B60DD970053AD4A /* KMScreenShotEditViewController.swift */,
+				BBFA1CE52B60DDC40053AD4A /* KMScreenShotEditViewController.xib */,
+				BBFA1CD52B60A0670053AD4A /* KMScreenShotMaskView.swift */,
+			);
+			path = Screen;
+			sourceTree = "<group>";
+		};
 		BBFBE6B128DD7B97008B2335 = {
 			isa = PBXGroup;
 			children = (
@@ -12826,6 +12874,7 @@
 				ADDF834A2B391A5C00A81A4E /* DSignatureDetailsViewController.xib in Resources */,
 				AD1CA4342A0640FC0070541F /* KMAnnotationScreenHeadView.xib in Resources */,
 				AD62606E2A9D968A006C6413 /* KMEditPDFAssets.xcassets in Resources */,
+				BBFA1CDE2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */,
 				ADEC7A81299397F8009A8256 /* SF-Pro-Text-Regular.otf in Resources */,
 				BB4EEF3029763EE7003A3537 /* KMRedactBaseWindowController.xib in Resources */,
 				BB254D5A2B2A985A00C37B3B /* KMTTSWindowController.xib in Resources */,
@@ -13082,6 +13131,7 @@
 				AD3AAD452B0B7B7B00DE5FE7 /* KMCompareThumbView.xib in Resources */,
 				ADFCEB482B4FBA440001EBAF /* RemoteConfigDefaults.plist in Resources */,
 				ADFA8F0D2B579957002595A4 /* KMSearchFindView.xib in Resources */,
+				BBFA1CD12B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */,
 				9FDD0FA22952FF4D000C4DAD /* $themes.json in Resources */,
 				BB69C95C299116FD0001A9B1 /* five_line_score.pdf in Resources */,
 				BBFE6E702930D9C600142C01 /* KMMergeSettingWindowController.xib in Resources */,
@@ -13132,6 +13182,7 @@
 				BBB29BCE2AEA190D005F1B6B /* KMToolbarCustomViewController.xib in Resources */,
 				BB276A5C2B038D3A00AB5578 /* KMOCRPDFWindowController.xib in Resources */,
 				BBC70EA92AEA6EF800AC1585 /* KMToolbarCustomWindowController.xib in Resources */,
+				BBFA1CE62B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */,
 				BB328B6D2B565BEC00B382C6 /* iVersion.bundle in Resources */,
 				89DB5DAA291B8DE70029624F /* KMOutlineEditViewController.xib in Resources */,
 				BB003029298CF7EC002DD1A0 /* KMPreferenceDisplayController.xib in Resources */,
@@ -13427,6 +13478,7 @@
 				BBB376AB2B10A7FD009539CC /* a_3a.png in Resources */,
 				BB90E4EB2AF347A700B04B9F /* PreferenceWindow.xib in Resources */,
 				9FBA0EF228FFC716001117AF /* KMHomeFastToolViewController.xib in Resources */,
+				BBFA1CDF2B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */,
 				ADF6B8712A480CCE0090CB78 /* KMComparativeView.xib in Resources */,
 				ADCFFC0729C04617007D3657 /* BOTA.xcassets in Resources */,
 				AD1CA4152A061CCD0070541F /* KMAnnotationScreenColorViewItem.xib in Resources */,
@@ -13459,6 +13511,7 @@
 				F356720929AF184A00740FF3 /* CPDFListAnnotationNoteWindowController.xib in Resources */,
 				ADDF838D2B391A5D00A81A4E /* DSignatureFileListCellView.xib in Resources */,
 				9FDD0FA32952FF4D000C4DAD /* $themes.json in Resources */,
+				BBFA1CE72B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */,
 				AD199DEC2B230B1300D56FEE /* KMPrintMultipageView.xib in Resources */,
 				BB1BFF622AE9FA6C003EB179 /* KMBatchOperateBaseWindowController.xib in Resources */,
 				9FE0BBE82B0EFBA300CD1CAC /* KMAnnotationFontWindowController.xib in Resources */,
@@ -13604,6 +13657,7 @@
 				9F0CB5462986953A00007028 /* KMURLToPDFWindowController.xib in Resources */,
 				ADE86ACD2B034CC000414DFA /* KMAddBackgroundView.xib in Resources */,
 				ADDF834B2B391A5C00A81A4E /* DSignatureDetailsViewController.xib in Resources */,
+				BBFA1CD22B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */,
 				9F8539E8294712D600DF644E /* KMChromiumTabContents.xib in Resources */,
 				BB5F8A1A29BB15AD00365ADB /* pic_mail.pdf in Resources */,
 				BBA922162B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib in Resources */,
@@ -13806,6 +13860,7 @@
 				ADDF834C2B391A5C00A81A4E /* DSignatureDetailsViewController.xib in Resources */,
 				BB3BA9082A13684A00623C08 /* Assets.xcassets in Resources */,
 				AD0FA51829A9FA8F00EDEB50 /* KMResetPasswordView.xib in Resources */,
+				BBFA1CE02B60DC0C0053AD4A /* KMScreenShotMaskViewController.xib in Resources */,
 				ADE3C1E929A5ABC200793B13 /* KMLoginWindowController.xib in Resources */,
 				ADF6B8722A480CCE0090CB78 /* KMComparativeView.xib in Resources */,
 				AD8810B729A846B100178CA1 /* KMVerficationCodeWindowController.xib in Resources */,
@@ -14062,6 +14117,7 @@
 				ADFCEB4A2B4FBA440001EBAF /* RemoteConfigDefaults.plist in Resources */,
 				ADFA8F0F2B579957002595A4 /* KMSearchFindView.xib in Resources */,
 				BB51074429A61B4100978662 /* ProgressSheet.xib in Resources */,
+				BBFA1CD32B609EC50053AD4A /* KMScreenShotMaskWindowController.xib in Resources */,
 				89316857296E45CA0073EA59 /* KMImageAccessoryController.xib in Resources */,
 				9FBA0EEB28FFC2FE001117AF /* Image.xcassets in Resources */,
 				BBA922172B4E783F0061057A /* KMPurchaseCompareDMGWindowController.xib in Resources */,
@@ -14112,6 +14168,7 @@
 				BB1969DD2B2842D700922736 /* SnapshotWindow.xib in Resources */,
 				BB69C95E299116FD0001A9B1 /* five_line_score.pdf in Resources */,
 				BB89725B294C559F0045787C /* KMWatermarkPropertyCreateController.xib in Resources */,
+				BBFA1CE82B60DDC50053AD4A /* KMScreenShotEditViewController.xib in Resources */,
 				BB328B6F2B565BEC00B382C6 /* iVersion.bundle in Resources */,
 				ADBC2D3C299F0A5A006280C8 /* KMPrintHelpViewController.xib in Resources */,
 				AD1D481E2AFB6B96007AC1F0 /* KMMergeWindowController.xib in Resources */,
@@ -14539,6 +14596,7 @@
 				ADDF83562B391A5C00A81A4E /* DSignatureCreateViewController.swift in Sources */,
 				AD0FA50A29A9E74200EDEB50 /* KMLoginInputPasswordView.swift in Sources */,
 				8942F80329262B2E00389627 /* KMSideViewController.swift in Sources */,
+				BBFA1CC92B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */,
 				AD59993E2AD7E88600412F8B /* KMStampManager.swift in Sources */,
 				BB147014299DC0D100784A6A /* OIDAuthState.m in Sources */,
 				BB3AAB9029878CE000992A5A /* KMWatermarkAdjectivePropertyMainController.swift in Sources */,
@@ -14961,6 +15019,7 @@
 				BBA922352B4E97540061057A /* KMPurchaseFirstTrialWindowController.swift in Sources */,
 				9F705F76291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift in Sources */,
 				BB147002299DC0D100784A6A /* OIDScopeUtilities.m in Sources */,
+				BBFA1CDA2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */,
 				AD867FA629DFB77500F00440 /* KMAnnotationOutlineView.swift in Sources */,
 				AD3AAD5C2B0DA3D400DE5FE7 /* KMCompareTextViewItem.swift in Sources */,
 				ADDF83352B391A5C00A81A4E /* CPDFListViewConfig.m in Sources */,
@@ -15057,6 +15116,7 @@
 				BB1A91732AFB8D95005E5FD8 /* KMBookletMaskView.swift in Sources */,
 				9F1FE4F629406E4700E952CA /* CTFloatingBarBackingView.m in Sources */,
 				9FE0BBE42B0EFBA300CD1CAC /* KMAnnotationFontWindowController.swift in Sources */,
+				BBFA1CE22B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */,
 				9F53D5532AD683A700CCF9D8 /* KMAnnotationPropertyBaseController.swift in Sources */,
 				AD8810A029A8459000178CA1 /* KMComparativeTableViewController.swift in Sources */,
 				BBEB93EF2AD6C72C00739573 /* KMPDFMergePageRangeTabelViewCell.swift in Sources */,
@@ -15138,6 +15198,7 @@
 				AD0E8AB92A31BDDD00DBFD3C /* KMProduct.swift in Sources */,
 				BB403BAA2B15CA6E00B3106D /* KMBatchConvertOperation.swift in Sources */,
 				9FB220EC2B185B3100A5B208 /* KMButtomCell.swift in Sources */,
+				BBFA1CCD2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */,
 				9F1FE4C929406E4700E952CA /* CTTabContents.m in Sources */,
 				9FCFEC882AD0EF9900EAD2CB /* KMPopMenuButton.swift in Sources */,
 				9F39B9442A661ED500930ACA /* KMHomeScrollView.swift in Sources */,
@@ -15146,6 +15207,7 @@
 				BB897218294AED6C0045787C /* KMWatermarkAdjectivePreViewBaseController.swift in Sources */,
 				ADAFDA162AE8DD6600F084BC /* KMAdvertisementCollectionHeadView.swift in Sources */,
 				BBBAECF42B57672200266BD3 /* SKPresentationOptionsSheetController.swift in Sources */,
+				BBFA1CD62B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */,
 				ADE8BC2F29F8CD7200570F89 /* KMPDFThumbnailModel.swift in Sources */,
 				BBBAECFC2B57713F00266BD3 /* KMTransitionInfo.swift in Sources */,
 				BB4EEF4029764FCC003A3537 /* KMWatermarkColorView.swift in Sources */,
@@ -15319,6 +15381,7 @@
 				9FB220ED2B185B3100A5B208 /* KMButtomCell.swift in Sources */,
 				9F1FE51229407B4000E952CA /* KMFileSearchView.swift in Sources */,
 				BB14702A299DC0D100784A6A /* OIDAuthorizationService.m in Sources */,
+				BBFA1CD72B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */,
 				ADDF83B12B391A5D00A81A4E /* KMDSignatureManager.m in Sources */,
 				9FF94F1229A7476000B1EF69 /* KMDesignPropertySelector.swift in Sources */,
 				ADBC2D0D299CAA65006280C8 /* KMBaseXibView.swift in Sources */,
@@ -15365,6 +15428,7 @@
 				BB8810652B4F74DD00AFA63E /* KMRepeatTrialAlertController.m in Sources */,
 				BB162E8F294FFC0C0088E9D1 /* KMWatermarkPDFView.swift in Sources */,
 				AD9527C7295295110039D2BC /* KMPrintPrinterModel.swift in Sources */,
+				BBFA1CCA2B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */,
 				BBA388142AEF9A42004FE93F /* NSWindow+KMExtension.swift in Sources */,
 				BBFE6E88293210AB00142C01 /* KMCompressCellView.swift in Sources */,
 				899700F728F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
@@ -15788,6 +15852,7 @@
 				AD1CA4222A061D190070541F /* KMAnnotationScreenAuthorViewItem.swift in Sources */,
 				BB3A81B62AC2C0F4006FC66C /* NSObject+KMExtension.swift in Sources */,
 				BBC3481D295593F0008D2CD1 /* KMBackgroundListController.swift in Sources */,
+				BBFA1CCE2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */,
 				9F5664882988B16F00020985 /* KMTextfieldVC.swift in Sources */,
 				89D2D2FC294C806000BFF5FE /* KMPDFThumbnailItem.swift in Sources */,
 				BB3D970B2B2FEAC8007094C8 /* KMPDFRedactViewController.swift in Sources */,
@@ -15849,6 +15914,7 @@
 				ADDF83452B391A5C00A81A4E /* DSignatureManager.swift in Sources */,
 				BB2F61592966B69D001CB369 /* KMWatermarkPropertyHomeController.swift in Sources */,
 				BB146FC4299DC0D100784A6A /* GTMReadMonitorInputStream.m in Sources */,
+				BBFA1CE32B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */,
 				BB1B0AC02B4FC6E900889528 /* KMGuideInfoWindowController.swift in Sources */,
 				BB1BFF7A2AEA0B8E003EB179 /* KMBatchOperateRightViewController.swift in Sources */,
 				BB1B0ADB2B4FC6E900889528 /* KMOpenFileGuideToolbar.swift in Sources */,
@@ -16095,6 +16161,7 @@
 				BB162E98295062CD0088E9D1 /* KMPageRangeTools.swift in Sources */,
 				AD8810B329A846B100178CA1 /* KMVerficationCodeWindowController.swift in Sources */,
 				ADE86AF82B0AF59A00414DFA /* KMCompareContentSettingView.swift in Sources */,
+				BBFA1CDB2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */,
 				BB981E532AD4F638001988CA /* KMCoverButton.swift in Sources */,
 				BB5F8A0F29BB04F000365ADB /* GBDeviceInfo_OSX.m in Sources */,
 				BBB7B48A2A033F6200B58A5A /* KMThumbnailView.swift in Sources */,
@@ -16409,6 +16476,7 @@
 				BB89723C294B3C840045787C /* KMWatermarkPropertyController.swift in Sources */,
 				BB65A07E2AF8E5A4003A27A0 /* KMLineWell.swift in Sources */,
 				9FBA0F0029015A82001117AF /* KMFastToolCollectionViewItem.swift in Sources */,
+				BBFA1CE42B60DD970053AD4A /* KMScreenShotEditViewController.swift in Sources */,
 				BB146FD1299DC0D100784A6A /* GTMMIMEDocument.m in Sources */,
 				9FCFECA62AD237B500EAD2CB /* KMBatchTableRowView.swift in Sources */,
 				BBAC26A62AFE134300563A08 /* KMToolbarItemPopViewController.swift in Sources */,
@@ -16813,6 +16881,7 @@
 				BB31DA642AFA3088006D63CB /* KMPreferenceController.swift in Sources */,
 				BB146FE6299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				89E4E7842967BF5A002DBA6F /* KMCustomizeStampViewController.m in Sources */,
+				BBFA1CD82B60A0670053AD4A /* KMScreenShotMaskView.swift in Sources */,
 				BB146FFB299DC0D100784A6A /* OIDExternalUserAgentMac.m in Sources */,
 				ADDEEA5C2AD399BB00EF675D /* KMSignature.swift in Sources */,
 				BBBB6CD82AD150D20035AA66 /* CPDFCircleAnnotation+PDFListView.swift in Sources */,
@@ -16991,6 +17060,7 @@
 				BB1B0AFA2B4FC6E900889528 /* KMOpenFileFunctionView.swift in Sources */,
 				9F5664892988B16F00020985 /* KMTextfieldVC.swift in Sources */,
 				ADAFDA3B2AE8EEFF00F084BC /* KMAdvertisementRequestServer.swift in Sources */,
+				BBFA1CCB2B60967A0053AD4A /* KMScreenShotHandler.swift in Sources */,
 				BBD1F77E296F9BE000343885 /* KMPageEditSettingBaseWindowController.swift in Sources */,
 				9F080B25298FCB0D00FC27DA /* KMDesignToken+Action.swift in Sources */,
 				BB67EE1F2B54FFEF00573BF0 /* ASIFormDataRequest.m in Sources */,
@@ -17100,6 +17170,7 @@
 				BB146FD4299DC0D100784A6A /* GTLRDateTime.m in Sources */,
 				ADDDCE262B43A32A005B4AB5 /* AppSandboxFileAccess.m in Sources */,
 				BB5F8A2129BB15AD00365ADB /* KMEmailSubWindowController.m in Sources */,
+				BBFA1CCF2B609E890053AD4A /* KMScreenShotMaskWindowController.swift in Sources */,
 				BB6CA4CE298BB0D000A13864 /* KMPreferenceWindowController.swift in Sources */,
 				BB2EDF48296E4618003BCF58 /* KMPageEditTools.swift in Sources */,
 				BBF729C12B19783600576AC5 /* KMBatchRemoveHeaderFooterOperation.swift in Sources */,
@@ -17295,6 +17366,7 @@
 				AD9527D52952D51A0039D2BC /* KMPrintPresenter.swift in Sources */,
 				ADD1B6D92946BDFD00C3FFF7 /* KMPrintChoosePageSizeView.swift in Sources */,
 				9FB220D92B0F4ED400A5B208 /* KMAnnotationSelectLinkViewController.swift in Sources */,
+				BBFA1CDC2B60DBF90053AD4A /* KMScreenShotMaskViewController.swift in Sources */,
 				BBFDFAA02AF3814000E08AA2 /* KMTextHintWindowController.swift in Sources */,
 				9F0CB50F2986564500007028 /* KMDesignToken+BorderLeft.swift in Sources */,
 				BB2CC5662AF123A400D7A796 /* KMBatchHeader.swift in Sources */,