|
@@ -1572,20 +1572,24 @@ extension KMBrowserWindowController: KMSystemFileMenuProtocol {
|
|
KMPrint("screenShot_Window")
|
|
KMPrint("screenShot_Window")
|
|
KMScreenShotHandler.beginScreenShot_SelectWindowCompleteHandler { ima in
|
|
KMScreenShotHandler.beginScreenShot_SelectWindowCompleteHandler { ima in
|
|
if let image = ima {
|
|
if let image = ima {
|
|
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
|
|
|
- let folderPath = self.createBaseFoldPath()
|
|
|
|
- let savePathOld = folderPath + "/screenShot.pdf"
|
|
|
|
- var savePath = self.filePathCheck(path: savePathOld)
|
|
|
|
- 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 {
|
|
|
|
- if self.checkOpenNewDocument(path: savePath) {
|
|
|
|
- self.savePdf(savePath)
|
|
|
|
|
|
+ if CGSizeEqualToSize(image.size, CGSizeZero) == true {
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
|
|
|
+ let folderPath = self.createBaseFoldPath()
|
|
|
|
+ let savePathOld = folderPath + "/screenShot.pdf"
|
|
|
|
+ var savePath = self.filePathCheck(path: savePathOld)
|
|
|
|
+ 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 {
|
|
|
|
+ if self.checkOpenNewDocument(path: savePath) {
|
|
|
|
+ self.savePdf(savePath)
|
|
|
|
+ }
|
|
|
|
+ // try? FileManager.default.removeItem(atPath: savePath)
|
|
|
|
+ } else {
|
|
|
|
+
|
|
}
|
|
}
|
|
-// try? FileManager.default.removeItem(atPath: savePath)
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|